Microsoft

Video: Three PowerShell scripts for managing users in Active Directory Domain Services

Bill Detwiler shares three scripts that make it easy to manage users in Active Directory via PowerShell, such as copying group memberships.

Obtaining user object information via Active Directory Users And Computers is fine for the one-time use, but it falls short for batch tasks. During this episode of TR Dojo, I'll share three scripts make it easy to pull user information from Active Directory via PowerShell.

For those who prefer text to video, you can click the Transcript link that appears below the video player window. And to make it easier for you to try out and modify the PowerShell scripts I discuss in the video, here is the text for each one:

Changing an attribute for a group of users
Get-ADUser -Filter * -SearchBase "OU=Accounting,OU=UserAccounts,DC=YourDomain,DC=com" | Set-ADUser -Manager "John Doe"
Copying one user's group memberships to a second user
Get-ADPrincipalGroupMembership -Identity JohnDoe | % {Add-ADPrincipalGroupMembership -Identity JaneDoe -MemberOf $_}
Pulling a list of user accounts with passwords that don't expire
Search-ADAccount -PasswordNeverExpires | FT Name, ObjectClass, UserPrincipalName

For more PowerShell tips and tricks, check out the following resources from TechRepublic and around the Web:

You can also sign up to receive the latest TR Dojo lessons through one or more of the following methods:

About

Bill Detwiler is Managing Editor of TechRepublic and Tech Pro Research and the host of Cracking Open, CNET and TechRepublic's popular online show. Prior to joining TechRepublic in 2000, Bill was an IT manager, database administrator, and desktop supp...

Editor's Picks

Free Newsletters, In your Inbox