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
kwatt562Asked:
Who is Participating?
 
remmett70Commented:
instead of the computer name put

$env:COMPUTERNAME

This will pull the computer name from the environment variable of the computer it is running on.
0
 
remmett70Commented:
Have you considered using powershell and active directory cmdlets?

ADD-ADGroupMember will add computers to groups easily.
0
 
kwatt562Author Commented:
Not really, as don't no much about powershell. Will check out though
0
Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

 
kwatt562Author Commented:
cool, can they be packaged into a bat file or something so can just be clicked on?
0
 
remmett70Commented:
They can be run from a .bat  You would just do something like this

Powershell.exe -executionpolicy remotesigned -File  c:\scripts\script.ps1
0
 
kwatt562Author Commented:
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?
0
 
kwatt562Author Commented:
that worked, thanks a lot
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.