Public/Get-NetExtenderProfile.ps1
function Get-NetExtenderProfile { [CmdletBinding()] param() $tempFile = [System.IO.Path]::GetTempFileName() try { Start-Process -FilePath "C:\Program Files (x86)\SonicWall\SSL-VPN\NetExtender\NECLI.exe" -ArgumentList "displayprofile" -Wait -NoNewWindow -RedirectStandardOutput $tempFile $vpnProfilesRaw = Get-Content -Path $tempFile } catch { Write-Error "Failed to run NECLI.exe" exit 1 } if($vpnProfilesRaw.Count -eq 1) { Write-Verbose "No profiles found." Return } else { $vpnProfiles = @() $profileCounter = 0 foreach($profile in $vpnProfilesRaw) { if($profileCounter -eq 0) { $vpnProfilesHeaders = (($profile.Trim().SubString(15) -replace '\s{2,}', ' ').Trim()) -Split " " $profileCounter++ } else { $row = New-Object PSObject $properties = (($profile.Trim().SubString(15) -replace '\s{2,}', ' ').Trim()) -Split " " $propertyCounter = 0 foreach($header in $vpnProfilesHeaders) { $row | Add-Member -MemberType NoteProperty -Name $header -Value $properties[$propertyCounter] $propertyCounter++ } $vpnProfiles += $row $profileCounter++ } } } return $vpnProfiles } Export-ModuleMember -Function Get-NetExtenderProfile -Alias Get-NEProfile |