Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

netdom

Status
Not open for further replies.

seamus19

IS-IT--Management
Mar 10, 2003
37
0
0
CA
does anyone know the syntex to use
netdom join
What i would like to do is be able to join all 2k machines within the domain (2k domain)from a command prompt.
I would do this if the active directory fails so I don't want to rejoin each workstation manually
 
thanks Jpoandl
this helps a lot will let you know if it works
 
If you need to add machines in bulk, you might want to do it with a script. This script disjoins machines froma list, then joins them to a new domain. You could obviously just comment out the disjoin part.


'==========================================================================
'
' NAME: NetDomJoinWorkstations
'
' AUTHOR: Mark D. MacLachlan , The Spider's Parlor
' URL: ' DATE : 6/24/2003
'
' COMMENT: Joins computers to a new domain. Edit domain name, user ID and passwords below
' Modification 7/28/2003 to include Remove command. Suggest synchronizing old and new server passwords
'
'==========================================================================

On Error Resume Next

'open the file system object
Set oFSO = CreateObject("Scripting.FileSystemObject")
set WSHShell = wscript.createObject("wscript.shell")
'open the data file
Set oTextStream = oFSO.OpenTextFile("wslist.txt")
'make an array from the data file
RemotePC = Split(oTextStream.ReadAll, vbNewLine)
'close the data file
oTextStream.Close

For Each strWorkstation In RemotePC
'Do something useful with strWorkstation
Call WSHShell.Run("cmd.exe /c NETDOM REMOVE " & strWorkstation &"/Domain:<domain> /UserD:<user> /PasswordD:<password> UserO:<user> /PasswordO:<password> /REBoot:30000")
Wscript.sleep 15000
Call WSHShell.Run("cmd.exe /c NETDOM JOIN " & strWorkstation &"/Domain:<domain> /UserD:<user> /PasswordD:<password> UserO:<user> /PasswordO:<password> /REBoot:0")

Next

I hope you find this post helpful. Please let me know if it was.

Regards,

Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top