kwatt562
asked on
Add PC to AD group with vbs
Hi,
I am preparing a script to rename and join a pc to the domain (specific OU) with a hta and vbs. As a second part to this I would like to auto add the PC to an AD group. However I am struggling to get information on how to add the PC to an AD group (AD group is called Computer_Policy)
Does anyone know how this can be achieved? can find info on adding users but not PC's
thanks
I am preparing a script to rename and join a pc to the domain (specific OU) with a hta and vbs. As a second part to this I would like to auto add the PC to an AD group. However I am struggling to get information on how to add the PC to an AD group (AD group is called Computer_Policy)
Does anyone know how this can be achieved? can find info on adding users but not PC's
thanks
ASKER
Not really, as don't no much about powershell. Will check out though
The work is done for you with Powershell.
http://blogs.technet.com/b/heyscriptingguy/archive/2013/12/25/powertip-add-computer-to-security-group-with-powershell.aspx
http://blogs.technet.com/b/heyscriptingguy/archive/2013/12/25/powertip-add-computer-to-security-group-with-powershell.aspx
ASKER
cool, can they be packaged into a bat file or something so can just be clicked on?
They can be run from a .bat You would just do something like this
Powershell.exe -executionpolicy remotesigned -File c:\scripts\script.ps1
Powershell.exe -executionpolicy remotesigned -File c:\scripts\script.ps1
ASKER
awesome thanks, is there a way to do it without having to manually enter the PC name (i.e it takes the name of the PC being run on?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
that worked, thanks a lot
ADD-ADGroupMember will add computers to groups easily.