Powershell Active Directory Account Attribute to a variable

Posted by Bill Garrett on Programmers See other posts from Programmers or by Bill Garrett
Published on 2013-10-29T18:46:42Z Indexed on 2013/10/29 22:17 UTC
Read the original article Hit count: 306

Filed under:

Sorry for the newbie question. I am using Powershell 3 to get a list of all user accounts. I am trying to generate an output for accounts, either "Enabled" or "Disabled". I am able to get the account status code from active directory using:

$rc = $Rech.PropertiesToLoad.Add("userAccountControl");

That will display the correct account status code.

When I try to use an if statement on the value, I dont get any result. How do I put this value into a variable to use some logic with it?

In the end, my requirements are to have the output to an CSV file that I can send to HR and have them examin it and instead of a code I would like to have it say "Enabled" or "Disabled".

Thank you.

© Programmers or respective owner

Related posts about powershell