As an IT Pro, we may have a requirement to add multiple users or computer in an Active Directory group. The below Powershell script can be used to add multiple user or computer to an AD group. The list of users / computers need to be provided in the text file.
Usage: See below example. To see full help Type script name and press enter. For adding the users or computer to AD group, you have to provide computer NetBIOS name or user name (SAM Account) in text file.
Add computer to AD Group
.\AddObjectsToADGroup.ps1 -FileName Computers.txt -ADGroupName "TestGroup" -ObjectType Computer .
Add user to AD group
.\AddObjectsToADGroup.ps1 -FileName Computers.txt -ADGroupName "TestGroup" -ObjectType User
You can also download the script from below link.
Related Posts:
- Powershell – Get System up time
- Powershell Script : List AD Organizational Unit and GPOs linked to them
- Powershell – Compare hardware and software details on two computers
- Powershell Script : Retrieve AD Computers Properties
- Powershell – Merge CSV files & Insert file name as a column
- Powershell Script: Validate if Computer account exists in Active Directory
- Powershell remote – WinRM cannot complete the operation
- Powershell script to Add bulk users / computers to AD Group
- PowerShell Script : Copy AD Group Membership
- Using PowerShell Behind a Proxy Server
Subscribe to Techuisitive Newsletter
Be the first to know about our new blog posts. Get our newsletters directly in your inbox and stay up to date about Modern Desktop Management technologies & news.