Sign in to follow this  
Followers 0
shornw

@Comspec /k

10 posts in this topic

Can someone tell me what is wrong with this. I have little hair left and am in danger of tearing the it out.

It all goes absolutely OK, but I get "Installer encountered an error: 0x8000ffff. Catastrophic failure".

If I run the same text manually in a command prompt (I outputted it to a Notepad session to ensure the syntax was correct)

it works just fine.

The IPConfig (for test purposes) works no problem

#include <Array.au3>
#include <File.au3>
#include <Array.au3>

$wbemFlagReturnImmediately = 0x10
$wbemFlagForwardOnly = 0x20
$colItems = ""
$Output=""
Dim $aInstalledList[1], $aPatch[1], $quit, $Result


$PatchList = FileOpenDialog("Select patch list text file", @ScriptDir, "(*.txt)")
If @error = 1 Then $quit = MsgBox(20, "ERROR", "No file was selected. Do you want to quit?")
If $quit = 6 Then
Exit
Else
_FileReadToArray($PatchList, $aPatch)
EndIf

$objWMIService = ObjGet("winmgmts:\\" & @ComputerName & "\root\cimv2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_QuickFixEngineering", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly)

If IsObj($colItems) then
For $objItem In $colItems
_ArrayAdd($aInstalledList, $objItem.HotFixID)
Next
EndIf
_ArrayDisplay($aInstalledList)

For $i = 1 to UBound($aPatch) -1
$Search = StringSplit($aPatch[$i], ":")
ToolTip("Processing " & $aPatch, 0, 40)
$Search = $Search[1] & $Search[2]
$Result = _ArraySearch($aInstalledList, $Search)
If $Result = -1 Then
ContinueLoop
Else
RunWait(@ComSpec & ' /k wusa /uninstall /' & $aPatch[$i] & ' /NoReStart')
;RunWait(@ComSpec & ' /k ipconfig')
EndIf
Next

[font='Comic Sans MS']Eagles may soar high but weasels dont get sucked into jet engines[/font]

Share this post


Link to post
Share on other sites



Why do you include Array twice? (I don't think its a problem)...

I think maybe the value in $aPatch[$i] ends up not what you think... Try to MsgBox that out instead of your runwait (for test) to make sure it has the data you are expecting.

Share this post


Link to post
Share on other sites

Include Array was a copy/paste error. :(

I have output to a Notepad session, then copied the text and pasted into a cmd prompt and it worked fine


[font='Comic Sans MS']Eagles may soar high but weasels dont get sucked into jet engines[/font]

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Change the line to that:

ShellExecuteWait('wusa', '/uninstall /' & $aPatch[$i] & ' /NoReStart')

Edit: Does it makes a difference if you compile as x64?

Edited by JFX

Share this post


Link to post
Share on other sites

Hmmm - Still no joy. Exactly the same error

It makes no difference whether it's compiled x86, x64 or uncompiled

c:\


[font='Comic Sans MS']Eagles may soar high but weasels dont get sucked into jet engines[/font]

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

What happens if you remove Comspec from the equation and just do a shellexecute?

ShellExecute("wusa.exe", '/uninstall /' & $aPatch[$i] & ' /NoRestart')

Might be easier to debug depending on return from ShellExecute

Edited by JLogan3o13

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

As stated above, I get exactly the same error.

This is REALLY frustrating as I know the syntax is correct - if I run the command manually, it works fine.

Any ideas on how to debug this would be much appreciated. As far as the script is concerned, the command completes successfully (either RunWait, ShellExecute or ShellExecuteWait, it fails after the command is launched.


[font='Comic Sans MS']Eagles may soar high but weasels dont get sucked into jet engines[/font]

Share this post


Link to post
Share on other sites

I'm under the impression that AutoIt's default path searching works slightly different than the one employed by cmd.

I've taken to always specifying full paths wherever a file argument is required, and haven't run into this since.

Not checked with your code(s) though, YMMV

wim

Share this post


Link to post
Share on other sites

there doesn't seem to be an issue with the path. To test this, I deliberately entered an incorrect parameter (/NoReboot instead of /NoRestart) which invoked the WUSA info page. Therefore the WUSA element IS being run


[font='Comic Sans MS']Eagles may soar high but weasels dont get sucked into jet engines[/font]

Share this post


Link to post
Share on other sites

Try to fully qualify your path to wusa.exe?

For 32bit OS: C:\Windows\System32\wusa.exe

For 64bit OS: c:windowssysnativewusa.exe

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0