ronnoco Posted March 18, 2011 Posted March 18, 2011 Hi all, We are quite new to using Windows and Sysprep is a different kettle of fish to the XP version I am use to. I have followed Brian Lee Jacksons Sysprep guide and all works well apart from I am not sure how to get a machine to automatically join the domain? Is there a setting in the unattend.xml file or do a need an additional xml file or a vbs script? We are using FOG to capture and deploy the image. Thanks very much in advance for any help/advice. Gary 1
JaTayler Posted March 18, 2011 Posted March 18, 2011 Hi ronnoco, We deployed Windows 7 to our machines in the summer of 2010 and used a .vbs script that was created for us which joined the machine to the domain automatically - all we need to do is enter the Asset Number of the machine and the script does the rest. We initially build a machine with Windows 7 and all the software etc... then copied a folder which contained the script and a little .cmd file, which initialised the script, to c:\windows\setup\scripts\ Then ran sysprep using the Out-of-box experience (OBE) option & captured the image using GHOST. When the machine was built, we ran through the OBE screens until it reboots. Get to the desktop & this little script pops up, we enter the asset number of the machine, click OK and viola, the machine is added to the domain If you would like a copy of the script and .cmd file, let me know I can just take out the specific info we have and send it to you. Cheers J 1
ronnoco Posted March 18, 2011 Author Posted March 18, 2011 Hi, Thanks for the quick reply and yes, if you could send me the script that would be great. If it can just show me what bits I need to fill in, that would be great! Cheers. Gary
EvLPhenom Posted March 18, 2011 Posted March 18, 2011 Hi, Is there any chance you could send it to me as well as I am just getting to this stage now and it seems like a good way to do it. Thanks in advance.
mo_vigilante Posted March 18, 2011 Posted March 18, 2011 Hiya, Is there any chance this could be sent to me also? Hopefully plan to do this soon and this will be great and soo useful to us. Any help will be greatly appreciated. Thanks. Mo
ronnoco Posted March 18, 2011 Author Posted March 18, 2011 Hi J, Thanks a lot for sending, will try soon. Just checking, do I call the .cmd file joindomain.cmd ? Thanks! Gary
JaTayler Posted March 18, 2011 Posted March 18, 2011 Hi Gary, We've called it setupcomplete.cmd but i assume it could be anything you like. I guess it would be a bit of trial and error to see what works. Cheers
JB_IT Posted March 18, 2011 Posted March 18, 2011 If you are using a FOG server you can set fog to add the machine to the domain and be put in any OU you specify, which i what i do to then automate software installs of other software which isn't in the image.
mrtechsystems Posted March 20, 2011 Posted March 20, 2011 Hi JaTayler Could do me a favour sent me the script so I can take a look would be useful Cheers
chrisbrown Posted March 21, 2011 Posted March 21, 2011 Why not put the script in the thread here so everyone can see it?
JaTayler Posted March 28, 2011 Posted March 28, 2011 (edited) Hi Guys, Sorry I haven't been on here for a bit. The stuff that you need to change is in red Cheers J ------------------------------------------------------------------------------------------------------------------------- Const JOIN_DOMAIN = 1 Const ACCT_CREATE = 2 Dim sCmpName Dim sUser, sPassword, sDomain, sOU [color="red"][b]sUser = "" sPassword = "" sDomain = "" [/b][/color] sCmpName = InputBox("Enter the new computer name:", "Computer Name") If sCmpName = "" Then Wscript.Echo "Exiting script." Wscript.Quit End If Dim oWMI, oCmp, oOS, sReturn Set oWMI = GetObject("winmgmts:\\.\root\cimv2") For Each oCmp in oWMI.InstancesOf("Win32_ComputerSystem") sReturn = oCmp.Rename(sCmpName) If sReturn <> 0 Then Wscript.Echo "Rename failed. Error = " & Err.Number & _ vbcrlf & "Exiting script." Else Wscript.Echo "Rename successful." sReturn = oCmp.JoinDomainOrWorkgroup(sDomain, sPassword, _ sDomain & "\" & sUser, sOU, JOIN_DOMAIN) If sReturn <> 0 Then Wscript.Echo "Join domain failed. Error = " & Err.Number & _ vbcrlf & "Exiting script." Else Wscript.Echo "Join domain successful." End If Wscript.Echo "Rebooting computer..." Dim oShell Set oShell = CreateObject("Wscript.Shell") sReturn = oShell.Run("%comspec% /c shutdown -r -t 0 -f") End If Next ------------------------------------------------------------------------------------------------------------------------- The script file is saved as JoinDomain.vbs The .cmd just contains: start c:\windows\setup\scripts\joindomain.vbs Both need to be copied into the Windows\Setup\Scripts folder so that they run when the machine logs in after the build All the best guys, hope it works for you Edited March 28, 2011 by ChrisH Code tags added
MkII Posted March 28, 2011 Posted March 28, 2011 Thanks for posting that! I have a script that pulls the asset tag from the machine which is what we use for PC naming. Dumb question : how does that script get deleted after the final boot?
andrewk2004 Posted April 13, 2011 Posted April 13, 2011 When the script runs, it does not join the Domain. I entered our information here with what JaTyler said change what was in RED.
roadrunner2348 Posted April 21, 2011 Posted April 21, 2011 Hi all, We are quite new to using Windows and Sysprep is a different kettle of fish to the XP version I am use to. I have followed Brian Lee Jacksons Sysprep guide and all works well apart from I am not sure how to get a machine to automatically join the domain? Is there a setting in the unattend.xml file or do a need an additional xml file or a vbs script? We are using FOG to capture and deploy the image. Thanks very much in advance for any help/advice. Gary I don't know what version of FOG your up to but I've been using version 0.29. It has a client you install in the image before your run sysprep. It handles the domain join, computer naming, and a host of other things. I believe all you need to do is put your active directory information into the FOG server (you need to encrypt your AD password first. instructions) and install the agent in the image before you sysprep it (get the agent from /fog/client). Justin
windstar Posted April 21, 2011 Posted April 21, 2011 Can you possibly provide the exact syntax of the entries we need to change? In other words is the user in the domain\user format or just the user name, is the domain the netbios name or domain.local and does the computer account need to be created in AD before this script runs?
dhorowitz Posted May 6, 2011 Posted May 6, 2011 I've experienced the same occurrence as windstar above, that the rename of the PC is successful, but when it tries to join the domain, it gives you the same join domain failed, error code 0. I also see even following the instructions on placing the files in the c:\windows\setup\scripts folder that they don't automatically run upon completion of the unattended setup. I can run the scripts physically by browsing to them, and it won't join the domain.
goodhead Posted May 10, 2011 Posted May 10, 2011 i used mysysprep version 2 it pops up asking for computer name and then asks you what domain you want. i have it auto populated with the 1 domain i have , so we just have to click ok. 1
dhorowitz Posted May 10, 2011 Posted May 10, 2011 Alright, we're somewhat there. This particular utility will join the PC automatically to the domain, but I can't get it to prompt us for a computer name. I've left the blank which is supposed to prompt, also I've deleted the line completely according to another site that should prompt it as well. Any more suggestions?
Jose Posted May 12, 2011 Posted May 12, 2011 not sure if its been posted before but this site here enables you to create the xml file that joins a domain without having to jumo through hoops the MS way. Windows 7 unattend.xml Generator
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now