?
Solved

Add PC to AD group with vbs

Posted on 2014-02-04
8
Medium Priority
?
310 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
Office 365 Training for IT Pros

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

 

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 2000 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

There are many software programs on offer that will claim to magically speed up your computer. The best advice I can give you is to avoid them like the plague, because they will often cause far more problems than they solve. Try some of these "do it…
Group policies can be applied selectively to specific devices with the help of groups. Utilising this, it is possible to phase-in group policies, over a period of time, by randomly adding non-members user or computers at a set interval, to a group f…
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.
This Micro Tutorial will give you a basic overview of Windows Live Photo Gallery and show you various editing filters and touches to photos you can apply. This will be demonstrated using Windows Live Photo Gallery on Windows 7 operating system.
Suggested Courses

765 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