I want my PowerShell script to stop when any of the commands I run fail (like set -e in bash). I\'m using both Powershell commands (New-Object System.Net.
set -e
New-Object System.Net.
I'm new to powershell but this seems to be most effective:
doSomething -arg myArg if (-not $?) {throw "Failed to doSomething"}