Solved

Add PC to AD group with vbs

Posted on 2014-02-04
8
302 Views
Last Modified: 2014-02-09
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
Comment
Question by:kwatt562
  • 4
  • 4
8 Comments
 
LVL 10

Expert Comment

by:remmett70
ID: 39834079
Have you considered using powershell and active directory cmdlets?

ADD-ADGroupMember will add computers to groups easily.
0
 

Author Comment

by:kwatt562
ID: 39834094
Not really, as don't no much about powershell. Will check out though
0
 
LVL 10

Expert Comment

by:remmett70
ID: 39834100
0
 

Author Comment

by:kwatt562
ID: 39834118
cool, can they be packaged into a bat file or something so can just be clicked on?
0
Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 
LVL 10

Expert Comment

by:remmett70
ID: 39834155
They can be run from a .bat  You would just do something like this

Powershell.exe -executionpolicy remotesigned -File  c:\scripts\script.ps1
0
 

Author Comment

by:kwatt562
ID: 39834187
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
 
LVL 10

Accepted Solution

by:
remmett70 earned 500 total points
ID: 39835672
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
 

Author Comment

by:kwatt562
ID: 39845534
that worked, thanks a lot
0

Featured Post

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Problem to With line 4 37
Turn on intranet settings 1 36
Linksys 4 port wireless router 62 42
Script  to move when join computer to domain 3 15
OfficeMate Freezes on login or does not load after login credentials are input.
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now