Active Directory PowerShell Script to Add Computers To AD Group

Active Directory PowerShell Script to Add Computers To AD Group. One of my friends helped me to get a PowerShell script that will help to Add Computer Accounts To A Security Group.

I thought of sharing the same so that it will be helpful to somebody.

Latest Post – SQL Query For SCCM Configuration Baselines Results | ConfigMgr HTMD Blog (anoopcnair.com)

Active Directory PowerShell Script to Add Computers To AD Group

This will work only on Windows 2008 R2 Domain Controllers.

Patch My PC
Active Directory PowerShell Script to Add Computers To AD Group
Active Directory PowerShell Script to Add Computers To AD Group

LISTOFCOMPUTERS.txt file is the input file and that should contain list of computers (hostnames) as shown in the below screenshot.

Replace the GROUPNAME with actual group name which you want to use.

Download the script from – TechNet Gallery

image_thumb[3]

Output will be as shown below.

1E Nomad
image
Active Directory PowerShell Script to Add Computers To AD Group 1

2 thoughts on “Active Directory PowerShell Script to Add Computers To AD Group”

  1. I recieve a cannot validate argument error!! Are you missing a parameter is your script?

    Add-ADPrincipalGroupMembership : Cannot validate argument on parameter ‘Identity’. The argument is null. Supply a non-null argument and try the command again.
    At I:\Office365\Scripts\bldg500 computers1.ps1:10 char:31
    + Add-ADPrincipalGroupMembership <<<< $b tjxg-laptop-computers-bldg-500c
    + CategoryInfo : InvalidData: (:) [Add-ADPrincipalGroupMembership], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.ActiveDirectory.Management.Commands.AddADPrincipalGroupMembership

    Reply

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.