Ghost Sysprep XP add computer to domain inside OU 
Author Message
 Ghost Sysprep XP add computer to domain inside OU

I've found two solutions to the problem whereby when you use ghost
console to add computers to the domain it puts them in the default
computer group. One of them is very simple and it simply adds a line
to the sysprep.inf file to move the computer account to the specified
organisational unit once it's been added to the domain:

MachineObjectOU="OU=CompName,DC=[ourdomain],DC=net"

Here's a VBScript that I have written that will do the trick. The XXXX
are the first 4 characters of the computer name, so you can ghost an
entire building of computers that have different names that will then
group them according to which room they're in (handy because we have 5
different computer labs that I separate into different OU's.

Anyway, just have your ghost task run this .vbs file as part of the
"run command" section in ghost, and also make sure that the file is
copied to the clients in the file transfer section of the task
definition. I've been using this for close to 6 months now and it runs
perfectly! It also deletes itself and reboots the computer once the
script has finished executing. You can also add more subs to it to set
default printer names depending on which room its in, and i do a few
other special things for our particular network.

Cheers, James

---ghost.vbs---

'XP Ghost Image First Run Script - James.Hoggett( nospam-AT-nospam
)utas.edu.au ?2003
On Error Resume Next
dim dong, quote
quote = chr(34)
Set wshNetWork = Wscript.CreateObject("Wscript.netWork")
dong = LCase(Left(wshNetWork.ComputerName,4))
select case dong
        case "XXXX"
        call addthe{*filter*}( wshNetWork.ComputerName,"OUNAME")
        case "XXXX"
        call addthe{*filter*}( wshNetWork.ComputerName,"OUNAME")
        case "XXXX"
        call addthe{*filter*}( wshNetWork.ComputerName,"OUNAME")
        case "XXXX"
        call addthe{*filter*}( wshNetWork.ComputerName,"OUNAME")

Sub addthe{*filter*} ( compname,ouname)
        Set WshShell = WScript.CreateObject( "WScript.Shell" )
Wscript.Sleep 10000
        nRtn = WshShell.Run("C:\windows\system32\netdom join " &
wshNetWork.ComputerName & " /domain:DOMAIN\DOMAINCONTROLLER /ou:OU=" &
ouname & ",OU=YOUROU,dc=yourdomainpath /userd:DOMAIN\Admin
/passwordd:domainadminpassword /usero:localadmin
/passwordo:localadminpassword", 1, false)
Wscript.Sleep 10000
End Sub

Const DeleteReadOnly = True
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.DeleteFile("C:\Program Files\Symantec\Ghost\Incoming\*.*"),
DeleteReadOnly

Set OpSysSet = GetObject("winmgmts:{(Shutdown)}//." _
 & "/root/cimv2").ExecQuery("select * " _
 & "from Win32_OperatingSystem where Primary=true")
for each OpSys in OpSysSet
 OpSys.Reboot()
next

---ghost.vbs---



Mon, 26 Sep 2005 10:02:09 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Add Computer Objects to Particular OU?

2. Adding Computer Objects to Particular OU

3. Computers from OU and then IP of those computers

4. Computers from OU and then IP of those computers

5. Add computer to domain

6. Add computer to domain

7. Add/join computer to Windows 2000 domain

8. How to add a computer accout to the domain

9. Add computer in domain with vbs or tools call by vbs

10. Add a computer to a domain

11. add user to every computer in domain

12. Adding Computer to Domain script

 

 
Powered by phpBB® Forum Software