I've been beating myself up over this...
When I use the vbscript below, it can't find hotfix KB2837643. I get "Not find hotfix KB2837643".
When I use ps and run get-hotfix, it's not listed in the list either.
What I am hoping to accomplish is uninstall a pesky hotfix that is breaking Outlook clients (not showing free/busy in calendars)
These were deployed via sccm config manager 2012. Since discovering the issue, I have disabled the update from my update list in sccm.
I am open to using either scripting methods. Please share your thoughts.
note: If you'd like to use the script for testing, please use cscript.exe <path to script> KB2837643
vbscript being used
Sub main()Dim objshell,objExecObject,count,HotFixID
If Wscript.Arguments.Count = 0 Then
WScript.Echo "Invalid Arguments "
Else
Dim arrHotFix()
For i = 0 to Wscript.Arguments.Count - 1
Redim Preserve arrHotFix(i)
arrHotFix(i) = Wscript.Arguments(i)
Next
For Each HotFixId In arrHotFix
UninstallHotFix(HotFixId)
Next
End If
End Sub
Function UninstallHotFix(HotFixID)
ID = Right(HotfixID,Len(hotfixid)-2)
If GetHotFix(HotFixID) = True Then
Set objshell = CreateObject("wscript.shell")
Set objExecObject = objshell.Exec("Cmd /c wusa.exe /uninstall /KB:" & ID & " /quiet /norestart")
Do
WScript.Sleep 3000
Loop Until FindWusa = False
If GetHotFix(HotFixID) Then
WScript.Echo "Failed to uninstall " & HotFixID
Else
WScript.Echo "Uninstall " & HotFixID & " Successfully."
End If
Else
WScript.Echo "Not find hotfix " & HotFixID
End If
End Function
Function FindWusa 'This function is to verify "wusa.exe" is running
set service = GetObject ("winmgmts:")
for each Process in Service.InstancesOf ("Win32_Process")
If Process.Name = "wusa.exe" then
Flag = True
Exit For
End If
Next
If Flag Then
FindWusa = True
Else
FindWusa = False
End If
End Function
Function GetHotFix(HotFixID)
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_QuickFixEngineering where HotFixID = '" & HotFixID & "'")
For Each colitem In colitems
If InStr(UCase(colitem.HotFixId),UCase(HotFixID)) > 0 Then
Flag = True
End If
Next
If Flag = True Then
GetHotFix = True
Else
GetHotFix = False
End If
End Function
Call main