How can i catch exeption of command powershell dsacls

Hi everyone,

I am deverloping a ps1 for setting permission public or non-pucblic for user on ADLDS

i am using the command dsacls follow guide

https://technet.microsoft.com/en-us/library/Cc771151(v=WS.10).aspx

anybody know how to catch the exeption of this command?

September 4th, 2015 4:29am

Hi Quyen,

sure thing:

You can do this by storing the output-string in a variable and parsing it. It might also be possible to check the exitcode for errors. Since dsacls is not a powershell function, cmdlet or .NET component, you cannot use try/catch on it, so these are the only options while using dsacls.

Cheers,

Free Windows Admin Tool Kit Click here and download it now
September 4th, 2015 4:55am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics