DerekL Posted April 15, 2010 Posted April 15, 2010 Hi Everyone, So I working on a script that will deploy images of Windows 7, to my Companies machines, it's been working, but all of a sudden for no reason that I can see, I've started to get an error, here's the code that is causing the problem: Func sysprepvista() FileCopy("x:\windows\system32\sysprep\sysprep.xml", "c:\windows\system32\sysprep\sysprep.xml") $oOXml = _XMLFileOpen("c:\windows\system32\sysprep\sysprep.xml", 'xmlns:sysprepxml="urn:schemas-microsoft-com:unattend"') If @error Then MsgBox(4096, "File Open Error", "Error Opening File. Exiting program") Exit EndIf Local $path = "/sysprepxml:unattend/sysprepxml:settings[@pass='oobeSystem']/sysprepxml:component[@name='Microsoft-Windows-International-Core']/sysprepxml:InputLocale" _XMLUpdateField($path, IniRead($inifile, "Keyboardlocale", GUICtrlRead($Keyboard), "en-US")) Local $path = "/sysprepxml:unattend/sysprepxml:settings[@pass='oobeSystem']/sysprepxml:component[@name='Microsoft-Windows-International-Core']/sysprepxml:SystemLocale" _XMLUpdateField($path, IniRead($inifile, "Keyboardlocale", GUICtrlRead($Keyboard), "en-US")) Local $path = "/sysprepxml:unattend/sysprepxml:settings[@pass='oobeSystem']/sysprepxml:component[@name='Microsoft-Windows-International-Core']/sysprepxml:UILanguage" _XMLUpdateField($path, IniRead($inifile, "Keyboardlocale", GUICtrlRead($Keyboard), "en-US")) Local $path = "/sysprepxml:unattend/sysprepxml:settings[@pass='oobeSystem']/sysprepxml:component[@name='Microsoft-Windows-International-Core']/sysprepxml:UserLocale" _XMLUpdateField($path, IniRead($inifile, "Keyboardlocale", GUICtrlRead($Keyboard), "en-US")) MsgBox(0, "localinfo", IniRead($inifile, "Keyboardlocale", GUICtrlRead($Keyboard), "en-US")) Local $path = "/sysprepxml:unattend/sysprepxml:settings[@pass='specialize']/sysprepxml:component[@name='Microsoft-Windows-UnattendedJoin']/sysprepxml:Identification/sysprepxml:Credentials/sysprepxml:Username" _XMLUpdateField($path, GUICtrlRead($UserName)) Local $path = "/sysprepxml:unattend/sysprepxml:settings[@pass='specialize']/sysprepxml:component[@name='Microsoft-Windows-UnattendedJoin']/sysprepxml:Identification/sysprepxml:Credentials/sysprepxml:Password" _XMLUpdateField($path, GUICtrlRead($Password)) Local $path = "/sysprepxml:unattend/sysprepxml:settings[@pass='specialize']/sysprepxml:component[@name='Microsoft-Windows-UnattendedJoin']/sysprepxml:Identification/sysprepxml:Credentials/sysprepxml:Domain" _XMLUpdateField($path, GUICtrlRead($Domain)) Local $path = "/sysprepxml:unattend/sysprepxml:settings[@pass='specialize']/sysprepxml:component[@name='Microsoft-Windows-UnattendedJoin']/sysprepxml:Identification/sysprepxml:JoinDomain" _XMLUpdateField($path, GUICtrlRead($Domain)) MsgBox(0, "Progress", "Added username, password and domain") Local $path = "/sysprepxml:unattend/sysprepxml:settings[@pass='specialize']/sysprepxml:component[@name='Microsoft-Windows-Shell-Setup']/sysprepxml:ComputerName" _XMLUpdateField($path, GUICtrlRead($ComputerName)) Local $path = "/sysprepxml:unattend/sysprepxml:settings[@pass='specialize']/sysprepxml:component[@name='Microsoft-Windows-Shell-Setup']/sysprepxml:TimeZone" _XMLUpdateField($path, GUICtrlRead($TimeZone)) Local $path = "/sysprepxml:unattend/sysprepxml:settings[@pass='oobeSystem']/sysprepxml:component[@name='Microsoft-Windows-Shell-Setup']/sysprepxml:TimeZone" _XMLUpdateField($path, GUICtrlRead($TimeZone)) MsgBox(0, "Progress", "Added computername and timezone") MsgBox(0, "Progress", "Sorted keyboard locales") $oOXml = _XMLFileOpen("x:\windows\system32\drivers.xml", 'xmlns:test="urn:schemas-microsoft-com:unattend"') If @error Then MsgBox(4096, "File Open Error", "Error Opening File. Exiting program") Exit EndIf Local $path = "/test:unattend/test:settings[@pass='offlineServicing']/test:component[@name='Microsoft-Windows-PnpCustomizationsNonWinPE']/test:DriverPaths/test:PathAndCredentials/test:Path" Local $letter = finddriveletter() _XMLUpdateField($path, $letter & ":\Out-of-Box Drivers") FileCopy("x:\windows\system32\drivers.xml", "c:\windows\system32\drivers.xml") FileDelete("c:\windows\panther\sysprep.xml") FileDelete("c:\windows\panther\unattend.xml") FileCopy("c:\windows\system32\sysprep\sysprep.xml", "c:\windows\panther\sysprep.xml") FileCopy("c:\windows\system32\sysprep\sysprep.xml", "c:\windows\panther\unattend.xml") FileWriteLine("C:\Windows\Setup\SetupComplete.cmd", "del /Q /F c:\windows\system32\sysprep\sysprep.xml") FileWriteLine("C:\Windows\Setup\SetupComplete.cmd", "del /Q /F c:\windows\panther\sysprep.xml") FileWriteLine("C:\Windows\Setup\SetupComplete.cmd", "del /Q /F c:\windows\panther\unattend.xml") If (GUICtrlRead($KBoxAgent) == $GUI_CHECKED) Then FileWriteLine("C:\Windows\Setup\SetupComplete.cmd", "\\kbox.emea.arm.com\client\agent_provisioning\windows_platform\KInstallerSetup.exe -server=kbox.emea.arm.com -display_mode=silent") EndIf RunWait("notepad.exe c:\windows\system32\sysprep\sysprep.xml") injectdrivers() EndFunc ;==>sysprepvista So the line: If @error Then MsgBox(4096, "File Open Error", "Error Opening File. Exiting program") is causing the script to show the error message, and exit, I have an include for the _XMLDomWrapper.au3 and I'm including the constants when it's compiled, it's being run from a WinPE 3.0 USB stick, for the life of me I can't figure out what the problem is, any idea's Thanks Derek
DerekL Posted April 15, 2010 Author Posted April 15, 2010 Hi Guy's, It's OK, I now know what the problem is, you can forget this one. Thanks Derek
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