mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-08-13 06:27:16 +02:00
Improved check for $lastExitCode
This commit is contained in:
@ -18,7 +18,7 @@ try {
|
||||
if ($Connection.ConnectionStatus -ne "Disconnected") { continue }
|
||||
"Connecting to VPN $($Connection.Name)..."
|
||||
& rasdial.exe "$($Connection.Name)"
|
||||
if ($lastExitCode -ne "0") { throw "Cannot establish connection" }
|
||||
if ($lastExitCode -ne 0) { throw "Cannot establish connection" }
|
||||
"Connected now."
|
||||
exit 0 # success
|
||||
}
|
||||
|
Reference in New Issue
Block a user