?
Solved

script to join a computer to a domain

Posted on 2009-06-27
6
Medium Priority
?
942 Views
Last Modified: 2013-11-08
Hello, im wanting a script to join a computer to a domain. I have a lot of machines that have been sysprep'd and i would like a way to automate joining a domian.

I know its possible within the sysprep.inf file but its not secure because sysprep.inf is not securly deleted (can be retrieved along with the passwords).  From the documentation i read, it says this is possible throught WMI but im not too sure on how to do this and whether this would be the best method. Any help or advice welcome?
0
Comment
Question by:resolver1
[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
6 Comments
 
LVL 20

Accepted Solution

by:
Lazarus earned 1600 total points
ID: 24729921
0
 

Author Comment

by:resolver1
ID: 24730522
What are the parameters? How do I pass the parameters to the VBS file?  Ive created a few programs before but not VB Script, usually the paremeters are on the sub or Function line?
0
 
LVL 10

Assisted Solution

by:itsmein
itsmein earned 400 total points
ID: 24731619
see code snippet for usage details
Usage: cscript.exe NetDomOU.vbs Join|Unjoin|Remove /Domain:domain [/OU:ou] [/User:user] [/Password:password]
 
 
 
Join: Joins the computer to a domain.
 
 
 
Unjoin: Unjoin the computer from a domain. No other arguments required. The domain computer account will not be deleted!
 
 
 
Remove: Unjoin the computer from a domain and delete the domain computer account. No other arguments required. Administrative permissions on the domain are required! (The /user-argument is ignored). Wait for replication to finish before rejoining the computer!
 
 
 
/Domain: Name of the domain.
 
 
 
/User: The usersaccount used to execute the command, using the domain\username or username@domain notation! Leave username and password empty to use callers credentials.
 
 
 
/OU: The full 'distinguished name' of the organisational unit where the new domain computer account will be created when joining a domain. Example /OU:"OU=myOU, DC=domain, DC=com". The name must be between quotes! Leave empty to add the computer to the default 'Computers'-container. 
 
 
 
/Reboot: Reboot the computer if Join/Unjoin/Remove whas succesfull.

Open in new window

0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 

Author Comment

by:resolver1
ID: 24734134
cheers, i'll give it a go tomorrow. thanks
0
 

Author Comment

by:resolver1
ID: 24743037
thanks, works a treat!
0
 

Author Closing Comment

by:resolver1
ID: 31597624
cheers mate, you've helped out a lot here.  
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

752 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