Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

try and catch commands...

$
0
0

hi 

trying to display a custom message on screen if error occurs but no success...  

the option works great with get-process  for example. but not withGet-WmiObject  

here are the results: 

when i change the command to  get-process , it works great :  

no idea why... 

p.s - i tried to replace the "TRY-Catch" option , with "Trap-Continue", and got the same thing...   

powershell version is 3.0  and the $ErrorActionPreference set to "Continue"  


Viewing all articles
Browse latest Browse all 21975

Trending Articles