Solved

Add PC to AD group with vbs

Posted on 2014-02-04
8
309 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:kwatt562
ID: 39834118
cool, can they be packaged into a bat file or something so can just be clicked on?
0
 
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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

A hard and fast method for reducing Active Directory Administrators members.
After seeing many questions for JRNL_WRAP_ERROR for replication failure, I thought it would be useful to write this article.
The viewer will learn how to successfully download and install the SARDU utility on Windows 7, without downloading adware.
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

696 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