You can exit the script and assign your own exit code, any nonzero returns $false after checking with $?
# at the end of thre sript
exit 1
# But if you're executing the script from the console you'll have to
# execute it in another PowerShell instance, e.g.
powershell c:\err.ps1
$?
--
Kiron


