Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Join Domain Script

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,31779
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Join Domain Script
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Join Domain Script - 3/2/2006 12:30:16 AM   
  CarlT

 

Posts: 3
Score: 0
Joined: 11/10/2005
Status: offline
Hi

I have a one script to rename the workstation and one script using Netdom to join the Domain, only problem with this approach is a reboot required between these.... Is there a way to rename and join in one go? Appreciate if someone can point me in the right direction.. :)

My intial computers are in a Workgroup and not member of the domain yet, So the script is to rename the PC and join the domain with the new ID without a reboot. I'm currently using Rational Visual Test to do this, but that involves starting the native System GUI and I'm trying to avoid this.

Thanks
Carl

< Message edited by CarlT -- 3/2/2006 12:47:29 AM >
 
 
Post #: 1
 
 RE: Join Domain Script - 3/2/2006 3:18:46 AM   
  DiGiTAL.SkReAM


Posts: 1170
Score: 7
Joined: 9/6/2005
From: Florida, USA
Status: offline
DOes netdom require a reboot after renaming the PC?
If you can't get away from the reboot, you might consider doing a one-time autologin and have the script kick off right after login.  Then, after login, have the script disable the autologin.  That's what we do during our workstation domain-joins.

_____________________________

"Would you like to touch my monkey?" - Dieter (Mike Meyers)

"It is better to die like a tiger, than to live like a pussy."
-Master Wong, from Balls of Fury

(in reply to CarlT)
 
 
Post #: 2
 
 RE: Join Domain Script - 3/2/2006 3:50:06 AM   
  CarlT

 

Posts: 3
Score: 0
Joined: 11/10/2005
Status: offline
Hi

Well Netdom can't rename a NON Domain PC.

The way our rollout is scheduled is to image and sysprep all the systems offsite, hence the need to sysprep without the JoinDomain setting. So the goal is to have a system rename and domain join the first time the system boots in the production net.

Regards
Carl

(in reply to DiGiTAL.SkReAM)
 
 
Post #: 3
 
 RE: Join Domain Script - 3/21/2006 1:38:17 AM   
  hdeters

 

Posts: 1
Score: 0
Joined: 3/20/2006
Status: offline
Here I have to reboot several times as well to rename and to join the domain using batchfiles.It is not a problem because everything goes without user input.
  1. We put the image on the PC, the PC starts and gets an automaticaly generated name (sysprep). It reboots at the end.
  2. At startup a batchfile gets the IPaddress and finds the DNS name. The PC is renamed with the DNSname and reboots.
  3. Now the PC is joined to the domain at startup and ready to go
If anyone has a VBScript that reduces the amount of reboots, please let us know...

(in reply to CarlT)
 
 
Post #: 4
 
 RE: Join Domain Script - 4/10/2006 11:55:56 AM   
  manu4u007

 

Posts: 8
Score: 0
Joined: 3/20/2006
Status: offline
Check this out if this helps

Script to rename a computer account
=========================
Set objNewOU = GetObject("LDAP://OU=Finance,DC=fabrikam,DC=com")
Set objMoveComputer = objNewOU.MoveHere _    ("LDAP://CN=atl-pro-037,OU=Finance,DC=fabrikam,DC=com", _ "CN=atl-pro-003")

Joining a computer to a domain
=========================
Const JOIN_DOMAIN             = 1
Const ACCT_CREATE             = 2
Const ACCT_DELETE             = 4
Const WIN9X_UPGRADE           = 16
Const DOMAIN_JOIN_IF_JOINED   = 32
Const JOIN_UNSECURE           = 64
Const MACHINE_PASSWORD_PASSED = 128
Const DEFERRED_SPN_SET        = 256
Const INSTALL_INVOCATION      = 262144

strDomain   = "FABRIKAM"
strPassword = "ls4k5ywA"
strUser     = "shenalan"

Set objNetwork = CreateObject("WScript.Network")
strComputer = objNetwork.ComputerName

Set objComputer = GetObject("winmgmts:{impersonationLevel=Impersonate}!\\" & _
   strComputer & "\root\cimv2:Win32_ComputerSystem.Name='" & _
       strComputer & "'")

ReturnValue = objComputer.JoinDomainOrWorkGroup(strDomain, _
                                               strPassword, _
                                               strDomain & "\" & strUser, _
                                               NULL, _
                                               JOIN_DOMAIN + ACCT_CREATE)


Leme know if that  works without a reboot, honestly not sure.

~Cheers
KILLER

(in reply to CarlT)
 
 
Post #: 5
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Join Domain Script Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts