dgisdet Posted May 13, 2011 Posted May 13, 2011 Do You have to change anything in your unattend xml file
LostOracle Posted May 16, 2011 Posted May 16, 2011 Thanks to JaTaylor for the vbs script useful addition to the arsenal.
dhorowitz Posted May 24, 2011 Posted May 24, 2011 I tried to create the XML file using Ben O'Sullivan's XML generator, and that crashed my image with error "Windows could not parse or process unattend answer file c:\windows\panther\unattend.xml for pass specialize. The answer file is invalid. My IT director shot down any thought of using a third party tool such as mysysprep since it is not being authorized by Microsoft. Any suggestions?
ihaveaproblem Posted July 7, 2011 Posted July 7, 2011 How can i delete the autojoindomain.vbs after its ran? I dont want it left on the computer since it contains password
Steve21 Posted July 7, 2011 Posted July 7, 2011 How can i delete the autojoindomain.vbs after its ran? I dont want it left on the computer since it contains password You should be able to just add: Dim objFSO Set objFSO = CreateObject("Scripting.FileSystemObject") objFSO.DeleteFile WScript.ScriptFullName Set objFSO = Nothing at the end. So it'll delete itself, might want to test it, but should work. Steve
ihaveaproblem Posted July 7, 2011 Posted July 7, 2011 Thanks Steve. I'll give it a go and report back
ihaveaproblem Posted July 7, 2011 Posted July 7, 2011 The lines you said work perfect Steve, thanks. Problem now is i'm getting error 0 and not joining the domain like others have said, so it's not working ^^
Steve21 Posted July 7, 2011 Posted July 7, 2011 The lines you said work perfect Steve, thanks. Problem now is i'm getting error 0 and not joining the domain like others have said, so it's not working ^^ Did it work before you added those lines? Or wasn't it working before? It could be as simple as a command you're trying to do before the delete takes a while to complete, and you're deleting the script before it finishes. Aka could put a huge delay in the delete. Steve
ihaveaproblem Posted July 7, 2011 Posted July 7, 2011 Yup it worked before i added the lines, but now i've deleted the lines and tried again and it still doesnt work, odd.
ihaveaproblem Posted July 7, 2011 Posted July 7, 2011 I've took this script from another site and it seems to work, but it doesnt prompt for a computer name or automaticaly restart. Do any of you clever script people know if its possible to add the above to this script 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)
Steve21 Posted July 7, 2011 Posted July 7, 2011 I've took this script from another site and it seems to work, but it doesnt prompt for a computer name or automaticaly restart. Do any of you clever script people know if its possible to add the above to this script If you actually mean prompting for pc name: strComputer = UserInput( "Choose a pc name:" ) Instead of: Set objNetwork = CreateObject("WScript.Network") strComputer = objNetwork.ComputerName But isn't this supposed to be an unattended file? To do a restart you can do it like this: Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate,(Shutdown)}!\\" & _ strComputer & "\root\cimv2") Set colOperatingSystems = objWMIService.ExecQuery _ ("Select * from Win32_OperatingSystem") For Each objOperatingSystem in colOperatingSystems objOperatingSystem.Reboot() Next Think that should do it! If you want the restart a bit shorter, you can use: Set shellCommand= WScript.CreateObject("WScript.Shell") shellCommand.Run "C:\WINDOWS\system32\shutdown.exe -r -t 0" Only issue is things start occuring like if people don't have the shutdown.exe in that place. But if its your own domain just rename where it is. Steve 1
Davit2005 Posted July 7, 2011 Posted July 7, 2011 We use a PowerShell script We put a SetupComplete.cmd file in the C:\Windows\Setup\Scripts folder which then runs import.ps1 from the c:\windows\system32\sysprep\ folder the cmd also deletes the file as you don't want to leave any sensitive usernames or passwords on the C: drive jus in case. The script of the import.ps1 You need to change the parts in red to suit your environment. $User = "domain\user" $Pass = ConvertTo-SecureString "Password" -AsPlainText -Force $Credentials = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $User,$Pass add-computer -domainname domainname.local -credential $Credentials If you remove the ComputerName part the xml will wait for computer name as it sets up 1
ihaveaproblem Posted July 7, 2011 Posted July 7, 2011 (edited) Thanks. I will give both a in the morning back at work. It is suppose to be unattended... everything but the computer name that is. I want that to prompt me before joining the domain. EDIT I just tried the line you suggestioned Steve strComputer = UserInput( "Choose a pc name:" ) For me it gives an error saying 'type mismatch: "user input" Edited July 7, 2011 by ihaveaproblem
Steve21 Posted July 7, 2011 Posted July 7, 2011 Thanks. I will give both a in the morning back at work. It is suppose to be unattended... everything but the computer name that is. I want that to prompt me before joining the domain. EDIT I just tried the line you suggestioned Steve For me it gives an error saying 'type mismatch: "user input" Oops should be inputbox My bad, Steve 1
ihaveaproblem Posted July 8, 2011 Posted July 8, 2011 Sorry to be a pain. Both those shutdowns dont seem to work either? I've tried both and copied the text to the end of the script an on the second one shutdown.exe is in the same location it's pointing at. Am i doing something wrong? Also I plan to copy the delete command at the end as well to delete the script once ran.
Steve21 Posted July 8, 2011 Posted July 8, 2011 Sorry to be a pain. Both those shutdowns dont seem to work either? I've tried both and copied the text to the end of the script an on the second one shutdown.exe is in the same location it's pointing at. Am i doing something wrong? Also I plan to copy the delete command at the end as well to delete the script once ran. Well just ran: Set shellCommand= WScript.CreateObject("WScript.Shell") shellCommand.Run "C:\WINDOWS\system32\shutdown.exe -r -t 0" And it works fine. So I'm guessing either a typo, or you don't have access on the account you're running to do the command/exe? You sure you copied it right, and have access to run it? Where are you trying to run the script from? Also are you currently on XP doing it? Or actually on Win7? Just might be fussy and want /r /t instead of -r -t Steve
Davit2005 Posted July 8, 2011 Posted July 8, 2011 Is there any particular reason why you need the shutdown command? Are you just using ghost or WDS/SCCM method to deploy images? With the way we do sysprep (ghost), something we have found is you need to create a computer account for the machine prior to the machine running the setup part of the rebuild after image but apart from that it seem quite a straight forward task to perform once done a few times. Cheers, David
ihaveaproblem Posted July 8, 2011 Posted July 8, 2011 Thanks. Think i've got this sorted. I couldnt get the shutdown script to work... i really dont know why. In the end i set my answer file to prompt for a computer name, then the SetComplete.cmd ran the join domain script and also in the setupcompete is the command to do a restart after 1 minute. Works good:) and exactly what I wanted.
projector1 Posted November 26, 2011 Posted November 26, 2011 Has anyone Been able to input the join to a domain info into a sysprep file as it does have that functionality and need to call on any cb, batch files?
Popular Post Michael Posted November 26, 2011 Popular Post Posted November 26, 2011 This is how I run MySysprep2, manually name the workstation and automatically join the domain. I've used this on many networks 1. From your Windows 7 Pro SP1 disc (volume license) copy the install_Windows 7 PROFESSIONAL.clg file from the \Sources\ folder into: C:\Windows\System32\Sysprep\ 2. Download MySysprep2 here (scroll down the page) and extract MySysprep.exe into: C:\Windows\System32\Sysprep\ 3. Open up Notepad and paste the code below. Save the file as Sysprep.cmd in C:\Windows\System32\Sysprep\ Code: @echo off mysysprep /oobe /generalize /unattend:c:\windows\system32\sysprep\unattend.xml 4. Open up Notepad and paste the code below. Save the file as unattend.xml in C:\Windows\System32\Sysprep\ Code: en-GB en-GB en-US en-GB en-GB true Work 1 dwBlAGwAYwBvAG0AZQBQAGEAcwBzAHcAbwByAGQA false Local User LOCAL USERNAME administrators LOCAL USERNAME GMT Standard Time SCHOOL NAME SCHOOL NAME false FJ82H-XT6CR-J8D7P-XQJJ2-GPDD4 %Please input a computer name% SCHOOL NAME SCHOOL NAME false GMT Standard Time DOMAIN.DOMAIN ADMINISTRATOR PASSWORD DOMAIN.DOMAIN You just need to search/change the following: LOCAL USERNAME - A suitable local account, such as for teachers when they're working from home SCHOOL NAME - Enter your school name FJ82H-XT6CR-J8D7P-XQJJ2-GPDD4 - Default KMS key. You can change this for a MAK key (optional) %Please input a computer name% - Leave this as it is! DOMAIN.DOMAIN - Enter your FQDN (Fully Qualified Domain Name). This is a must! ADMINISTRATOR - Specify the domain administrator account (if renamed) PASSWORD - Specify the domain administrator password Run the Sysprep.cmd file with admin rights and Sysprep will start as normal. When the computer reboots, it'll prompt you for a computer name (of your choice) then join your domain. Windows 7 is then ready to be activated with a KMS server or will activate within 3 days with your MAK (depending what you entered). The automatically created computer object will be added to the Computers container where you can move it as required. You can specify an OU, but as all networks are different, I've tried to keep this as simple as possible! I hope this helps some of you! Good luck with your Windows 7 deployment! 6
projector1 Posted December 1, 2011 Posted December 1, 2011 i am trying to capture a reference windows 7 32bit pro image. I tried the mysysprep solution, however after capturing the image using imagex and then rebooting the machine i was prompted for a machine name but then recieved the following message "Windows could not complete the installation. To install windows on this computer restart the installation". i found this thread and tried the suggestions there but no joy. Windows could not complete the installation.
Michael Posted December 1, 2011 Posted December 1, 2011 I've never seen this and I've done lots of deployments recently. For people that see this message, could you confirm are you using an OEM, Retail or VLK license? If you're using an existing OEM machine with Windows 7 OEM already installed, is it a Dell, HP or Toshiba for example? What system model are you creating the image on? What version of Windows 7 are you using? Home Premium, Professional, Ultimate? Are you running x86 or x64 Windows 7? Are you running Windows 7 with SP1?
Davit2005 Posted December 1, 2011 Posted December 1, 2011 (edited) Along with Micheal! Initially had similar issues sure I downloaded a hotfix to apply before sysprep, and it was with a non-sp1 version, I'll check in morning. Edited December 1, 2011 by Davit2005
projector1 Posted December 20, 2011 Posted December 20, 2011 i am trying to capture a reference windows 7 32bit pro image. I tried the mysysprep solution, however after capturing the image using imagex and then rebooting the machine i was prompted for a machine name but then recieved the following message "Windows could not complete the installation. To install windows on this computer restart the installation". i found this thread and tried the suggestions there but no joy. Windows could not complete the installation. resolved! i actually did an imagex capture of the reference machine as a backup just in case. As i did not sysprep the machine before i captured an image, this must have screwed it up. Many thanks Micheal for your mysysprep guide, worked a treat. I am baffled as to why the domain joining element of the standard sysprep tool does not work. Anyway mass cloning in progress at the moment.
Michael Posted December 21, 2011 Posted December 21, 2011 No problem at all. This is the most up-to-date user guide for using MySysprep and Windows 7. It's especially important to use the FQDN in the answer file, otherwise (as I found out) the computer won't correctly join the domain.
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