Solved

script to join a computer to a domain

Posted on 2009-06-27
6
929 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
  • 4
6 Comments
 
LVL 20

Accepted Solution

by:
Lazarus earned 400 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 100 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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 

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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How can I do this in Pyhton? 12 116
Unknown AD user under VMWare OU 4 54
Example unit tests with AngularJS 3 40
Sums of coloumns in html/java 15 67
Setting up a Microsoft WSUS update system is free relatively speaking if you have hard disk space and processor capacity.   However, WSUS can be a blessing and a curse. For example, there is nothing worse than approving updates and they just have…
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

867 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

20 Experts available now in Live!

Get 1:1 Help Now