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
Post a Comment