Suppressing Error Message


i running simple command:

remove-adgroupmember suppress error message account not found in group. tried running -erroraction silentlycontinue not getting luck?

thanks help.

even -erroraction stop ignored. need put command inside try block of try-catch in order silence error message, , instead display custom message. below example. read on try-catch, there's more can do, include having block displays regardless, include multiple catch blocks, , use specific error exceptions catch blocks. enter get-help -name about_try_catch_finally powershell console.

try {     remove-adgroupmember -identity 'print operators' -member notarealuser } catch {     write-warning -message 'a problem has occurred.' }





Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

2008 Windows Deployment Server Properties Error

Can no longer user MS Update - Files required to use Microsoft Update are no longer registered

How do a find data in one file, search for it in another file and if not found, write a custom message to another file