Jump to content
Sign in to follow this  
obfuscatedv

Cannot uninstall kb

Recommended Posts

Been stuck for several hours trying to uninstall a kb.  From the command prompt, it works fine:

cd c:

then,

C:WindowsSystem32wusa.exe /uninstall /kb:xxxxxxx /quiet /norestart

Wusa does its thing, finds the kb, after the wusa process is done restart the pc, and its gone.

For the autoit scripts Ive tried:

ShellExecute("wusa.exe" & '/uninstall /kb:xxxxxxx /quiet /norestart')

No luck ^

$wusa = @WindowsDir & "\System32\wusa.exe"
Run($wusa & " /uninstall /kb:xxxxxxx /quiet /norestart")

No luck ^

$cmd = "wusa.exe /uninstall /kb:xxxxxxx /quiet /norestart"
RunWait(@ComSpec & " /c " & $cmd, @WindowsDir & "\System32", @SW_HIDE)

No luck ^

;FileCopy(@ScriptDir & '\kbuninstall.cmd', "C:\Temp")
;Sleep(5000)
;RunWait('C:\Temp\kbuninstall.cmd', '', @sw_hide)

^ Even tried running both .cmd and .bat files locally

$x = RunWait(@ComSpec & " /c C:\Windows\System32\wusa.exe /uninstall /kb:xxxxxxx /quiet /norestart", @SystemDir, @SW_HIDE)
MsgBox(0, "", $x)

No luck on this either, although it does bomb out with error code -2147418113 which appears to be a "catastrophic failure," (lol) similar to this link:  https://social.technet.microsoft.com/Forums/systemcenter/en-US/a218e294-b0e6-4b26-80a9-4eef72476fff/wusaexe-uninstall-and-sccm?forum=configmgrsum

Searched up and down, never seen anything like it.  

Share this post


Link to post
Share on other sites

If your OS is a 64 bits, you can try to use the native x64 system32 directory by using @WindowsDir & "sysnative"  :

$wusa = @WindowsDir & "\SystemNative\wusa.exe"
Run($wusa & " /uninstall /kb:xxxxxxx /quiet /norestart")

Not really sure ..

Edited by jguinch

Share this post


Link to post
Share on other sites

If your OS is a 64 bits, you can try to use the native x64 system32 directory by using @WindowsDir & "sysnative"  :

This specific issue relates to running a .cmd/bat through ComSpec with a 32bit compiled .EXE on 64bit OS. In this case, Windows will use the cmd.exe in Syswow.

@OP try compile your AutoIT.exe in x64 architecture if you are using Windows x64.

Share this post


Link to post
Share on other sites

This specific issue relates to running a .cmd/bat through ComSpec with a 32bit compiled .EXE on 64bit OS. In this case, Windows will use the cmd.exe in Syswow.

@OP try compile your AutoIT.exe in x64 architecture if you are using Windows x64.

 

Fantastic, that did it.  I did not even think about that.  You rock!  Thanks!

Share this post


Link to post
Share on other sites

then just disabling redirection should work as well?

DllCall("kernel32.dll", "int", "Wow64DisableWow64FsRedirection", "int", 1)


,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites

Simple Fix try to add to your script one little line to that is missing.

#RequireAdmin ;~ this is whats missing UAC is not allowing the command to run.

ShellExecute("wusa.exe" & '/uninstall /kb:xxxxxxx /quiet /norestart')

UAC is blocking you, this is why its not working. 

I hope this works... let me know ...

 

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  

×
×
  • Create New...