LVCVA Posted March 29, 2011 Share Posted March 29, 2011 I am using a simple AutoIT script to deploy Windows 7 SP1 to our PCs. Here is the main line that runs the service pack: RunWait(@TempDir&"\windows6.1-KB976932-X64.exe /quiet /nodialog /norestart", @SystemDir, @SW_MINIMIZE) Note: The exe gets copied down to their temp folder in a previous line. This runs well and installs the SP but no other line after this one runs. (I have it do a couple of other things such as write to a log file on one of our servers and then to restart windows). I'm not using any loops. Should I be using something other than RunWait to accomplish this? Thanks. -Marc Link to comment Share on other sites More sharing options...
dufran3 Posted March 29, 2011 Share Posted March 29, 2011 How do you know that it is done installing? Updates usually take a while to install, especially a service pack...are you sure that it actually finishes? Link to comment Share on other sites More sharing options...
LVCVA Posted March 29, 2011 Author Share Posted March 29, 2011 Yes, it is finishing because it takes about an hour to run and I have a splash screen up during that time. In addition to that, if I manually reboot the PC, log back into it and run Winver, it indicates that SP1 is installed (where it was not there before). Just to clarify, here's my entire script: expandcollapse popup; Install Windows 7 (x64) Service Pack 1 ; Gives the ability to put in a date/time stamp in the log #include <Date.au3> ; Splash Screen Messages $Message1 = "Please do not turn off your computer" $Message2 = "Estimated Time: 1 Hour" $Message3 = "Start Time: "&@HOUR&":"&@MIN $Message4 = "Downloading Service Pack..." $Message5 = "Download Complete...Installing Service Pack..." $Message6 = "Updates Complete...Cleaning up Files and Restarting." $Message7 = "Thank you for your patience!" ; Display Splash windows and warn to not turn off PC SplashTextOn("Windows 7 Service Pack 1 Being Installed by ITD", $Message1&@LF&$Message2&@LF&$Message3&@LF&$Message4, 700, 400, -1, -1, 0, "", 24) Sleep(5000) FileCopy("\\Server\Scripts\Win7SP1\windows6.1-KB976932-X64.exe",@TempDir) ; Create RunOnce Key to Delete patch at next restart ; RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce","DelSP1","REG_SZ","\\LVCCMS5\Scripts\Win7SP1\Win7SP1Clean.exe") ; Update Splash ControlSetText("Windows 7 Service Pack 1 Being Installed by ITD","","Static1",$Message1&@LF&$Message2&@LF&$Message3&@LF&$Message5) Sleep(1000) ; Write start time to a log $file = FileOpen("\\Server\scripts\Win7SP1\Win7SP1.log", 1) FileWriteLine($file, @ComputerName&" Started at "&_Now()) FileClose($file) ; Indicate the SP1 has been installed RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\LVCVA Scripts", "Win 7 SP1", "REG_SZ", "Installed") ; Install KB976932 (Service Pack 1) RunWait(@TempDir&"\windows6.1-KB976932-X64.exe /quiet /nodialog /norestart", @SystemDir, @SW_MINIMIZE) Sleep(2000) ; Update Splash when service pack is finished installing ControlSetText("Windows 7 Service Pack 1 Being Installed by ITD","","Static1",$Message1&@LF&$Message2&@LF&$Message3&@LF&$Message6&@LF&$Message7) Sleep(1000) ; Remove Splash SplashOff() Sleep(1000) ; Write finish time to a log $file = FileOpen("\\Server\scripts\Win7SP1\Win7SP1.log", 1) FileWriteLine($file, @ComputerName&" Finished at "&_Now()) FileClose($file) Sleep(1000) ; Force Shutdown Shutdown(6) Link to comment Share on other sites More sharing options...
dufran3 Posted March 29, 2011 Share Posted March 29, 2011 Maybe try passing the installer through msiexec instead. I know in the past this has resolved some of the issues I had running through installers. Maybe replace RunWait(@TempDir&"\windows6.1-KB976932-X64.exe /quiet /nodialog /norestart", @SystemDir, @SW_MINIMIZE) with RunWait("msiexec /i" & @TempDir & "\windows6.1-KB976932-X64.exe /quiet /nodialog /norestart") Just a suggestion, not even sure if those flags "/quiet /nodialog /norestart" will work using this method, I don't have the file to check what install switches are available. 2nd Note: If this doesn't work, have you tried hard coding the location into the RunWait(), just to make sure it isn't being caused by the Macros somehow(idk, shot in the dark) Link to comment Share on other sites More sharing options...
LVCVA Posted March 29, 2011 Author Share Posted March 29, 2011 MSIExec as far as I know can only be used to launch MSI files. Thanks again. Link to comment Share on other sites More sharing options...
dufran3 Posted March 29, 2011 Share Posted March 29, 2011 (edited) MSIExec as far as I know can only be used to launch MSI files. Thanks again.That is a negative. So you tried it and it didn't work, or you just don't think it will work? Microsoft especially puts out files with .exe extensions that can be run using msiexec... Edited March 29, 2011 by dufran3 Link to comment Share on other sites More sharing options...
LVCVA Posted March 29, 2011 Author Share Posted March 29, 2011 That is incorrect. MSIExec is only used for installing MSI's and MSPs, not EXEs. To be complete, I did try it just now and MSIExec doesn't recognize the EXE as an argument. If you do a start run and then run msiexec /?, you'll see that the arguments it requires are for MSIs. Link to comment Share on other sites More sharing options...
dufran3 Posted March 29, 2011 Share Posted March 29, 2011 hmmm...I don't see anything strange in your code. Could just be the installer file...doesn't play nice maybe? Anyway, I would change the RunWait(@TempDir&"\windows6.1-KB976932-X64.exe /quiet /nodialog /norestart", @SystemDir, @SW_MINIMIZE) to Run(@TempDir&"\windows6.1-KB976932-X64.exe /quiet /nodialog /norestart", @SystemDir, @SW_MINIMIZE) Then add ProcessWaitClose() after the Run call and wait for the process to finish, that should get the job done. Link to comment Share on other sites More sharing options...
LVCVA Posted March 30, 2011 Author Share Posted March 30, 2011 Thanks again, Dufran3 but when I try this, the script automatically closes. Not sure what is going on here but changing the runwait to run made the script execute the remaining lines of the script before the run finished. It's like it ignored the processwaitclose. Link to comment Share on other sites More sharing options...
dufran3 Posted March 30, 2011 Share Posted March 30, 2011 Thanks again, Dufran3 but when I try this, the script automatically closes. Not sure what is going on here but changing the runwait to run made the script execute the remaining lines of the script before the run finished. It's like it ignored the processwaitclose.Are you positive that you are using the correct process name/ID, whichever you chose? I would confirm this! Try writing a little script that waits for process to appear, sends msgbox, then waits for it to close, then sends message box. Then try and manually open the SP1 file and verify you have everything write, and that the code works. Link to comment Share on other sites More sharing options...
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