PowerShell: throw error
throw
the keyword throw
exit the program and print an error.
$x = 3 if (7 -ne $x) { throw "you got a problem" }
Write-Error
the cmdlet write-error
print an error
but continue running the program.
$x = 3 if (7 -ne $x) { Write-Error "you got a problem"}