Uninstalling Windows Updates

I have recently deployed an WSUS server that is working well except that there is one update that is failing to install.

The update in question is the Group Policy Preference Client Side Extensions for Windows Vista (KB943729). All my computers on WSUS are reporting they do not have this installed and that they require it.

However prior to me setting up the WSUS server I had deployed this patch manually using the "wusa" command on all my computers.

I believe it is this manual install that is interfering with the WSUS install and so I am trying to uninstall this patch.

A manual uninstall works correctly however I have 500 machines to uninstall this patch on and so I am trying to script the uninstall.

I found a script to uninstall updates of the Microsoft website and have attached the script to this question

I have also attached the WindowsUpdate.log that shows the installation of the patch using the wusa command.

The output I am getting from the script is

E:\WSUS.vbs(22, 1) (null): 0x80240007

Line 22 is this line: objCollection.Add(colUpdates.Item(0))

I believe that if the patch was being found correctly then the Set colUpdates = objResults.Updates should return 1 rather than 0.

Can you please help me discover what is wrong with this patch.


Set objCollection = CreateObject("Microsoft.Update.UpdateColl")
Set objSearcher = CreateObject("Microsoft.Update.Searcher")
Set objResults = objSearcher.Search("UpdateID='764CCDDC-C9D7-4B6A-9AFA-B38EC97266BE'")
Set colUpdates = objResults.Updates
Wscript.echo colUpdates.count
Wscript.echo objCollection.count
Set objInstaller = CreateObject("Microsoft.Update.Installer")
objInstaller.Updates = objCollection
Set objInstallResults = objInstaller.Uninstall
Wscript.Echo objInstallResults.RebootRequired
Wscript.Echo objInstallResults.ResultCode

Open in new window

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

There has been the first update to GPCSE, maybe you installed the old one and this is the new one? The update was releases in the first two weeks of october if I remember correctly.
Anyway, you could
-decline this update at the wsus server if you don't expect new workstations to be added to the domain (no good, eh?)
-install it again through wsus (it is offered again, or not?) - why not?
it-servicesAuthor Commented:
I've tried installing it through WSUS except the install fails. If I manually uninstall the old manually installed patch then the WSUS update works.
So what I need is a way of scripting the removal of the old update
Look at which says that that error code 0x80240007 stands for
A The update to be removed is not installed on the system
B The index to a collection was invalid (whatever that means)
IT Pros Agree: AI and Machine Learning Key

We’d all like to think our company’s data is well protected, but when you ask IT professionals they admit the data probably is not as safe as it could be.

it-servicesAuthor Commented:
I think that B is the error that I am getting.
For some reason the Microsoft.Update.Searcher.Search method isn't returning any results when I specify that specific UpdateID. The UpdateID is the one that I have gotten out of the WindowsUpdate.log
Does anyone know of a script that i can run to output all the installed patches and their corresponding UpdateID's?
It assume you will find that collection of IDs at the WSUS when you let it list all installed updates at that system.
it-servicesAuthor Commented:
I've figured out a way to list all the UpdateID's installed and attached the code below.

I ran this on one of the computers having the problem and I have attached the results.

The Update that I want to remove is listed three times however when I use the specified UpdateID on my original script it still fails.

I'm not too sure where to go from here.

Set objSession = CreateObject("Microsoft.Update.Session")
Set objSearcher = objSession.CreateUpdateSearcher
intHistoryCount = objSearcher.GetTotalHistoryCount
Set colHistory = objSearcher.QueryHistory(1, intHistoryCount)
For Each objEntry in colHistory
    Wscript.Echo "Title: " & objEntry.Title
    WScript.Echo "UpdateID: " & objEntry.UpdateIdentity.UpdateID

Open in new window

it-servicesAuthor Commented:
I wasn't able to get this to work so I've just deployed Vista SP1 using SMS rather than WSUS and this seems to have fixed the problem with this update.

Thanks for your help McKnife. I'm going to try to assign you some points for the assistance.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.