JHager Posted March 13, 2012 Share Posted March 13, 2012 (edited) Hi Folks, Trying to get wusa to runwait with .msu patches. I have been using a script for XP machines that works flawlessly. However, as you all know, with WIN7 they introduced wusa.exe for the msu packages. I have seen very little regarding this issue so, I thought I would throw this out there. I know this is a long string of code, but I would dearly appreciate any help that you may recommend. Thanks in advance. This is my script for XP: expandcollapse popup#include <array.au3> ; 1) $debug=1 for on screen status, $debug=0 for silent $debug=0 ; path for scan32 $scan32="F:DATASharedAuditWizScanscanscan32.exe" ; 2) $logPath = path for patch install status. don't forget the trailing slash ; if patch is good, log will have extension of .ook - if any failed, will have extension of .bad $logPath="c:" ; 3) $patchPath for full path to executables ***remember to include trailing slash*** $patchPath="F:WINAPPSMSupdateWinXPUpPostSP32-14-12" ; 4) enter only the patch name, not the extention - ie. kb666 not kb666.exe ; remember to change the Dim $aPatches[x] statement to reflect the total number of patches Dim $aPatches[2] $aPatches[0]="KB2660465" $aPatches[1]="KB2661637" ; $aPatches[2]="" ; $aPatches[3]="" If $debug Then _ArrayDisplay ($aPatches,"$aPatches") EndIf ; 5) enter the runtime options for the patches. if necessary, run the patch from a cmd prompt - ie. kb666 /? ; remember to change the Dim $aOptions[x] statement to reflect the total number of patches Dim $aOptions[2] $aOptions[0]=" /quiet /norestart /overwriteoem" $aOptions[1]=" /quiet /norestart /overwriteoem" ; $aOptions[2]="" ; $aOptions[3]="" If $debug Then _ArrayDisplay ($aOptions,"$aOptions") EndIf $logFile=StringTrimRight(@ScriptName, 4) $logFileExtension=".ook" $audit=1 ; if it changes to 1 then scan32.exe will run afterwards If $debug Then MsgBox(0,"log file",$logPath & $logFile & $logFileExtension) EndIf $file = FileOpen($logPath & $logFile & $logFileExtension,1) FileWriteLine($file, "Patch Program: " & @ScriptName & @CRLF & _ "Patch Path: " & $patchPath & @CRLF & _ "Computer Name: " & @ComputerName & @CRLF & _ "Date: " & @MDAY & "-" & @MON & "-" & @YEAR & @CRLF) For $x = 0 to Ubound ($aPatches,1)-1 If Not RegRead("HKEY_LOCAL_MACHINESOFTWAREUDAF",$aPatches[$x]) Then If $debug Then MsgBox(0,"","Installing " & $patchPath & $aPatches[$x] & $aOptions[$x]) EndIf $status = RunWait($patchPath & $aPatches[$x] & $aOptions[$x],"",@SW_HIDE) $audit=1 If $debug Then MsgBox(0,$aPatches[$x],"status: " & $status) EndIf If $status=0 or $status=3010 Then RegWrite("HKEY_LOCAL_MACHINESOFTWAREUDAF",$aPatches[$x], "REG_DWORD", "00000001") Else $logFileExtension=".bad" EndIf FileWriteLine($file,$aPatches[$x] & " status:" & $status & @CRLF) Else FileWriteLine($file,$aPatches[$x] & " was already installed" & @CRLF) If $debug Then MsgBox(0,"",$aPatches[$x] & " was already installed") EndIf EndIf Next FileWriteLine($file,"Finished" & @CRLF & @CRLF) FileClose($file) If $logFileExtension <> ".ook" Then FileMove($logPath & $logFile & ".ook",$logPath & $logFile & $logFileExtension,1) EndIf If $audit Then Run($scan32,"",@SW_MINIMIZE) EndIf Now, below I have pasted what I have tried, incorporating wusa, resulting in various errors. Mainly, I receive, "Error: unable to execute external program". There are two scripts, using two different methods, neither seems to work. The WIN 7 scripts are truncated without all the other code that is inconsequential. Please see below: First WIN7 script: expandcollapse popup$patchPath="WinAppsMSupdateWIN72-14-12" ; 4) enter only the patch name, not the extention - ie. kb666 not kb666.exe ; remember to change the Dim $aPatches[x] statement to reflect the total number of patches Dim $aPatches[1] $aPatches[0]="KB2645640" ; $aPatches[1]="" ; $aPatches[2]="" ; $aPatches[3]="" If $debug Then _ArrayDisplay ($aPatches,"$aPatches") EndIf ; 5) enter the runtime options for the patches. if necessary, run the patch from a cmd prompt - ie. kb666 /? ; remember to change the Dim $aOptions[x] statement to reflect the total number of patches Dim $aOptions[1] $aOptions[0]=" /quiet /norestart" ; $aOptions[1]="" ; $aOptions[2]="" ; $aOptions[3]="" If $debug Then _ArrayDisplay ($aOptions,"$aOptions") EndIf $logFile=StringTrimRight(@ScriptName, 4) $logFileExtension=".ook" If $debug Then MsgBox(0,"log file",$logPath & $logFile & $logFileExtension) EndIf $file = FileOpen($logPath & $logFile & $logFileExtension,1) FileWriteLine($file, "Patch Program: " & @ScriptName & @CRLF & _ "Patch Path: " & $patchPath & @CRLF & _ "Computer Name: " & @ComputerName & @CRLF & _ "Date: " & @MDAY & "-" & @MON & "-" & @YEAR & @CRLF) For $x = 0 to Ubound ($aPatches,1)-1 If Not RegRead("HKEY_LOCAL_MACHINESOFTWAREUDAF",$aPatches[$x]) Then If $debug Then MsgBox(0,"","Installing " & $patchPath & $aPatches[$x] & $aOptions[$x]) EndIf $wusa = @SystemDir & "wusa.exe" $status = RunWait($wusa & $patchPath & $aPatches[$x] & $aOptions[$x],"",@SW_HIDE) Second WIN7 script: $patchPath="F:WINAPPSMSupdateWinXPUpPostSP32-14-12" ; 4) enter only the patch name, not the extention - ie. kb666 not kb666.exe ; remember to change the Dim $aPatches[x] statement to reflect the total number of patches Dim $aPatches[1] $aPatches[0]="KB2645640" ; $aPatches[1]="KB2661637" ; $aPatches[2]="" ; $aPatches[3]="" If $debug Then _ArrayDisplay ($aPatches,"$aPatches") EndIf ; 5) enter the runtime options for the patches. if necessary, run the patch from a cmd prompt - ie. kb666 /? ; remember to change the Dim $aOptions[x] statement to reflect the total number of patches ; Dim $aOptions[2] ;$aOptions[0]=" /quiet /norestart /overwriteoem" ; $aOptions[1]=" /quiet /norestart /overwriteoem" ; $aOptions[2]="" ; $aOptions[3]="" If $debug Then _ArrayDisplay ($aOptions,"$aOptions") EndIf $logFile=StringTrimRight(@ScriptName, 4) $logFileExtension=".ook" If $debug Then MsgBox(0,"log file",$logPath & $logFile & $logFileExtension) EndIf $file = FileOpen($logPath & $logFile & $logFileExtension,1) FileWriteLine($file, "Patch Program: " & @ScriptName & @CRLF & _ "Patch Path: " & $patchPath & @CRLF & _ "Computer Name: " & @ComputerName & @CRLF & _ "Date: " & @MDAY & "-" & @MON & "-" & @YEAR & @CRLF) For $x = 0 to Ubound ($aPatches,1)-1 If Not RegRead("HKEY_LOCAL_MACHINESOFTWAREUDAF",$aPatches[$x]) Then If $debug Then MsgBox(0,"","Installing " & $patchPath & $aPatches[$x] & $aOptions[$x]) EndIf $wusa = @SystemDir & "wusa.exe" $status = RunWait($wusa & " " & $patchPath & $aPatches[$x] & " /quiet /norestart") Edited March 13, 2012 by Melba23 Added code tags Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 13, 2012 Moderators Share Posted March 13, 2012 JHager,Welcome to the AutoIt forum. I cannot help you with the question - but I can with the formatting. When you post code all you have to do to get the pretty boxes (like the ones I have set for you above) is to use Code tags - put [autoit] before and [/autoit] after your posted code. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
DesktopMasters Posted June 27, 2018 Share Posted June 27, 2018 5+ Years later.. still funny. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted June 27, 2018 Moderators Share Posted June 27, 2018 @DesktopMasters please do not resurrect old threads, especially when you're adding nothing to the discussion. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! 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