NDTC Posted February 2, 2010 Posted February 2, 2010 Hi all, I'll go crazy with this stuff: I try to modify the answer file sysprep Unattend.xml for Windows Seven. Here's what I want to: <?xml version="1.0" encoding="utf-8"?> <unattend xmlns="urn:schemas-microsoft-com:unattend"> <servicing></servicing> <settings pass="specialize"> ... ... <component name="Microsoft-Windows-Deployment" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <RunSynchronous> <RunSynchronousCommand wcm:action="add"> <Description>Drivers Setup</Description> <Order>1</Order> <Path>cmd /c C:\Drivers\SetupDrivers.cmd</Path> </RunSynchronousCommand> <RunSynchronousCommand wcm:action="add"> <Description>Drivers Setup 2</Description> <Order>2</Order> <Path>cmd /c C:\Drivers\SetupDrivers2.exe /S</Path> </RunSynchronousCommand> </RunSynchronous> </component> </settings> ... ... </unattend> To do this, I realized this code snippet: expandcollapse popup#include <_XMLDomWrapper.au3> Global $SYSPREPFile = @ScriptDir & "\Unattend.xml" FileCopy("unattend.xml", "Unattend_" & FileGetTime("unattend.xml", 0, 1) & ".xml") _XMLFileOpen($SYSPREPFile, 'xmlns:un="urn:schemas-microsoft-com:unattend" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State"') Switch @error Case 1 ConsoleWrite("Parse Error" & @CRLF) Case 2 ConsoleWrite("No Object" & @CRLF) EndSwitch _XMLSelectNodes('//un:unattend/un:settings[@pass="specialize"]') If @error <> 0 Then ConsoleWrite('"//un:unattend/un:settings[@pass="specialize"]" not exist' & @CRLF) $Temp = _XMLCreateChildWAttr ('//un:unattend', 'settings', "pass", "specialize", "urn:schemas-microsoft-com:unattend") EndIf _XMLSelectNodes('//un:unattend/un:settings[@pass="specialize"]/un:component[@name="Microsoft-Windows-Deployment"]') If @error <> 0 Then ConsoleWrite('"//un:unattend/un:settings[@pass="specialize"]/un:component[@name="Microsoft-Windows-Deployment"]" not exist' & @CRLF) $Temp = _XMLCreateChildWAttr ('//un:unattend/un:settings[@pass="specialize"]', "component", "name", "Microsoft-Windows-Deployment") _XMLCreateAttrib('//un:unattend/un:settings[@pass="specialize"]/un:component[@name="Microsoft-Windows-Deployment"]', "processorArchitecture", "x86") _XMLCreateAttrib('//un:unattend/un:settings[@pass="specialize"]/un:component[@name="Microsoft-Windows-Deployment"]', "language", "neutral") _XMLCreateAttrib('//un:unattend/un:settings[@pass="specialize"]/un:component[@name="Microsoft-Windows-Deployment"]', "publicKeyToken", "31bf3856ad364e35") _XMLCreateAttrib('//un:unattend/un:settings[@pass="specialize"]/un:component[@name="Microsoft-Windows-Deployment"]', "versionScope", "nonSxS") _XMLCreateAttrib('//un:unattend/un:settings[@pass="specialize"]/un:component[@name="Microsoft-Windows-Deployment"]', "xmlns:wcm", "http://schemas.microsoft.com/WMIConfig/2002/State") _XMLCreateAttrib('//un:unattend/un:settings[@pass="specialize"]/un:component[@name="Microsoft-Windows-Deployment"]', "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance") EndIf _XMLSelectNodes('//un:unattend/un:settings[@pass="specialize"]/un:component[@name="Microsoft-Windows-Deployment"]/un:RunSynchronous') If @error <> 0 Then ConsoleWrite('"//un:unattend/un:settings[@pass="specialize"]/un:component[@name="Microsoft-Windows-Deployment"]/un:RunSynchronous" not exist' & @CRLF) $Temp = _XMLCreateChildNode ('//un:unattend/un:settings[@pass="specialize"]/un:component[@name="Microsoft-Windows-Deployment"]', "RunSynchronous", "", "urn:schemas-microsoft-com:unattend") EndIf _XMLSelectNodes('//un:unattend/un:settings[@pass="specialize"]/un:component[@name="Microsoft-Windows-Deployment"]/un:RunSynchronous/un:RunSynchronousCommand [@wcm:action="add"]') If @error <> 0 Then ConsoleWrite('"//un:unattend/un:settings[@pass="specialize"]/un:component[@name="Microsoft-Windows-Deployment"]/un:RunSynchronous/un:RunSynchronousCommand [@wcm:action="add"]" not exist' & @CRLF) $Temp = _XMLCreateChildWAttr ('//un:unattend/un:settings[@pass="specialize"]/un:component[@name="Microsoft-Windows-Deployment"]/un:RunSynchronous', "RunSynchronousCommand", "wcm:action", 'add') EndIf $Temp = _XMLCreateChildNode ('//un:unattend/un:settings[@pass="specialize"]/un:component[@name="Microsoft-Windows-Deployment"]/un:RunSynchronous/un:RunSynchronousCommand [@wcm:action="add"]', "Description", "Drivers Setup", "urn:schemas-microsoft-com:unattend") $Temp = _XMLCreateChildNode ('//un:unattend/un:settings[@pass="specialize"]/un:component[@name="Microsoft-Windows-Deployment"]/un:RunSynchronous/un:RunSynchronousCommand [@wcm:action="add"]', "Order", "1", "urn:schemas-microsoft-com:unattend") $Temp = _XMLCreateChildNode ('//un:unattend/un:settings[@pass="specialize"]/un:component[@name="Microsoft-Windows-Deployment"]/un:RunSynchronous/un:RunSynchronousCommand [@wcm:action="add"]', "Path", "cmd /c C:\Drivers\SetupDrivers.cmd", "urn:schemas-microsoft-com:unattend") Exit But this is what it gives: <?xml version="1.0" encoding="utf-8"?> <unattend xmlns="urn:schemas-microsoft-com:unattend"> <servicing></servicing> <settings pass="specialize"> ... ... <component xmlns="" name="Microsoft-Windows-Deployment"/> </settings> ... ... </unattend> I tried several combinations, but nothing was done ... If someone has a solution, I'm interested because I do not leave... Please Help!!! Thank's by advance...
NDTC Posted February 3, 2010 Author Posted February 3, 2010 Post Error.Original post is http://www.autoitscript.com/forum/index.php?showtopic=109354This post can be deleted.Sorry.
Recommended Posts