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