Wednesday, September 21, 2022

Simple Try Catch Statement

 Simple try catch statement 



# TRY CATCH


Try{

 <Code Goes HERE>

}Catch{

 

  $errormessage = $($PSItem.ToString())

  Write-Warning 'Error has occurred'

  Write-host 'Problem FOUND:' $errormessage -ForegroundColor Red -BackgroundColor White

}


No comments:

Post a Comment

Setting up ISE Profile with Options

  Here is updated ISE profile. You can use it to built your own and make few adjustments.       # STARTING ADDS-ON MENU # ...