• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2479
  • Last Modified:

Powershell - Change UserAccountStatus from 544 to 512

I have 750+ accounts to change the UserAccountStatus from 544 to 512 and I would like to do this with a powershell script rather than ADSIEDIT.  can you help me and give me the syntax, etc?

These are in an OU called "mydomain.com/FD/User Accounts"
0
stowyo
Asked:
stowyo
  • 5
  • 3
1 Solution
 
KenMcFCommented:
Do you have the MS AD cmdlets?



get-aduser -searchbase "OU=User Accounts,DC=MyDomain,DC=com" | Set-aduser  -PasswordNotRequired:$False

Open in new window

0
 
stowyoAuthor Commented:
Can I not just tell it 512 UserAccountControl?
0
 
stowyoAuthor Commented:
yea, get-aduser does nothing.  Do I need this cmdlets?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
KenMcFCommented:
being set to 544 is the passwordnotrequired attribute. So by doing this you are settings it to 512 if nothing else is enabled in User Account control. If something else is enabled it will also clear by settings it to 512.
0
 
KenMcFCommented:
they are the MS AD cmdlets  that are included in 2k8R2 and Win7
0
 
KenMcFCommented:
If you do not have the AD cmdlets I would download the free quest ad cmdlets


get-qaduser -searchroot "OU=User Accounts,DC=MyDomain,DC=com" | Set-qaduser  -ObjectAttributes @{useraccountcontrol=544}

Open in new window

0
 
stowyoAuthor Commented:
544 is password is required to be changed upon first logon and in this case, it meant bulk accounts were imported with the UserAccountControl to be set.  So if I want a 512 to be on this, I change your script above to say 512?
0
 
KenMcFCommented:
yeah, sorry. Was testing and forgot to change.
0

Featured Post

Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

  • 5
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now