Powershell: Script to add users from a text file to an Active Directory group using alternate credentials

posted in: Blog, Powershell | 0

Here is a short script which you can use to add users to an Active Directory Group. Just add a list of users in a text file, in this case called “users.txt”. Run the script and enter the credentials that has the appropriate permissions. Replace “Test_Group” with the group that you want to add the users to.

A tip is to add the -WhatIf statement after “Add-ADGroupMember -Credential $cred -Identity Test_Group -Member $_”, just to make sure that the script does what you want it do, before putting it in production. So, like this:

Add-ADGroupMember -Credential $cred -Identity Test_Group -Member $_ -WhatIf

Leave a Reply

* Copy This Password *

* Type Or Paste Password Here *