Tripredacus Posted December 2, 2008 Posted December 2, 2008 I wrote this up, but I don't have a name for it. Its highly incomplete, but if you have skills in AutoIT, you may be able to use it as well. Goal: To be able to automate software installations in Windows XP after imaging with Imagex.Our WinPE environment is a Vista Servicing 1.1 edition of WinPE 2.0, and uses Geezery's COM based ImageX HTA. Upon startup, the WinPE maps a drive to the WDS Server (z:) and a drive (v:) to the file server. It then registers the DLL for the HTA and then loads the HTA.Geezery's Imagex.HTAhttp://www.msfn.org/board/index.php?showtopic=97512I have modified the HTA by rewriting the functions for some of the buttons at the bottom. The Capture Image button now runs an app that remaps the network drives (as there is an issue with certain Intel controllers where the startnet.cmd mapping does not work). The Append button now runs the XP App installer. Here are those changes:Changed the following function:'****************************************************************************'* Append Image'****************************************************************************Sub AppendDim Answer Answer = window.confirm("Click OK to install XP apps") If Answer Then objshell.run("xp_pe_selector.exe"),0 Else End IfEnd SubThis is to replace the Append function. We do not let regular software deployment people do things like captures and appends, at least so they don't screw it up, but also to give us a better sense of image control. Anytime images are captured or appended, we use the command prompt, so I replaced this function. Xp_pe_selector.exe is the app install program. I have also replaced the graphic for the button that launches the Append() function.As a test, my program will install Nero 8 Essentials Suite 2 without a serial number. There is a folder on the file server that contains the install, and there is a CMD file which actually does the install process. I had created this way before hand, but Nero is one of the programs we most install. Here is the AUTOIT Code for XP_PE_SELECTOR.#include <GUIConstants.au3>Local $Msg, $button1, $Checkbox1$Form1 = GUICreate("Form1", 633, 454, 187, 113)$Label1 = GUICtrlCreateLabel("Select a Program to install", 32, 48, 126, 17)$Button1 = GUICtrlCreateButton("Start", 48, 304, 129, 25, 0)$Label2 = GUICtrlCreateLabel("Nero 8 Essentials Suite 2", 112, 96, 122, 17)$Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 80, 96, 17, 17)GUISetState()While 1$Msg = GuiGetMsg()Switch $MsgCase $GUI_EVENT_CLOSE Exit Case $button1 if GuiCtrlRead($Checkbox1) = $GUI_CHECKED then RunWait (@ComSpec & " /c md c:\temp\nero8ste2") RunWait (@ComSpec & " /c xcopy v:\software\nero\nero8ste2 c:\temp\nero8ste2 /e" ) RunWait (@ComSpec & " /c xcopy v:\software\installer.exe c:\docume~1\alluse~1\startm~1\programs\startup" ) RunWait (@ComSpec & " /c xcopy v:\software\cleanup.exe c:\pnpdrvrs\net" ) Else MsgBox(0, "error", "Nothing was selected!") EndIfEndSwitchWEndAs you can see, it doesn't do much. It also only has one option right now and has a lot of empty space in it. It also does not exit by itself after doing anything, but these are things that can be added later. I have already received a request to make it reboot after copying the files. Either way, when it is done, you close it and restart the PC. When it restarts to Windows, it will launch the INSTALLER.EXE that is in the Startup Folder. #include <File.au3>Sleep (1000)If FileExists ( "c:\temp\nero8ste2\installnero.cmd") Then $nero = 1 RunWait (@ComSpec & " /c c:\temp\nero8ste2\installnero.cmd")Else MsgBox ( 4096, "Status", "There are no programs to install!")EndIfMsgBox ( 4096, "Complete", "The installer is finished. Click OK to reboot")RegWrite ( "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnce" , "1" , "REG_SZ" , "c:\pnpdrvrs\net\cleanup.exe" )_FileWriteLog("c:\temp\rem.bat","taskkill /f /im installer.exe")_FileWriteToLine("c:\temp\rem.bat", 1, "taskkill /f /im installer.exe", 1)_FileWriteToLine("c:\temp\rem.bat", 2, "del c:\docume~1\administrator\startm~1\programs\startup\installer.exe", 1)_FileWriteToLine("c:\temp\rem.bat", 3, "del c:\docume~1\alluse~1\startm~1\programs\startup\installer.exe", 1)_FileWriteToLine("c:\temp\rem.bat", 4, "c:\windows\system32\shutdown.exe -r -f -t 0", 1)MsgBox ( 4096, "Debug", "Verify that the batch file is written" )Run ( "c:\temp\rem.bat" )The installer.exe checks to see if the Nero install CMD is present before trying to run. This will fix any issues of the files not copying, although it will still require the reboot at the end. I had known that I wanted the installer to run a cleanup program, but I couldn't figure out how to delete the program from the startup folder. Or else on the reboot it would try to run the installer again. I solved this issue by having the installer write a batch file that it could then execute. The batch file kills and deletes the installer and reboots. Prior is a registry entry that runs the cleanup. Note how the batch file deletes from Administrator and All Users. Through testing I had found that sometimes the installer will not be found in All Users but in Administrator.After the reboot, the RunOnce runs cleanup.exeSleep (1000)If FileExists ( "c:\windows\nerosetuplog.txt" ) Then MsgBox (4096, "Clean Up", "Now Cleaning Up installers", 3) RunWait (@ComSpec & " /c rmdir c:\temp\*.* /s /q") MsgBox (4096, "Clean Up", "Clean Up Process complete" )EndIfIt is real simple, however it does not always delete the temp folder, and sometimes it does. It does, however, always delete everything INSIDE of the temp folder. Note that it only does this after confirming that NERO is installed by looking for the log file. The log file is created by installnero.cmd.Well that's it!
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