• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 315
  • Last Modified:

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
0
kwatt562
Asked:
kwatt562
  • 4
  • 4
1 Solution
 
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
Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

 
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
 
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
 
kwatt562Author Commented:
that worked, thanks a lot
0

Featured Post

NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now