• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 618
  • Last Modified:

how to prepare script/batch files for remove msoffice products from the windows

i want to prepare script or batch file to remove microsoft office from my machine .
  • 3
3 Solutions
Michael PfisterCommented:
Open registry editor and navigate to

Under this key you'll find many subkeys. Locate the one that shows your Office version in the DisplayName value.
A bit further down in the same key is a value named QuietUninstallString.
Take the value and put it in a batch to silently remove Office.

Can you please tell me how far you have gone with this issue, and provide an update so I know whether to post a suggestion here.  You have 3 other questions open that all relate to whatever problem you had (presumably virus activity), and there are suggestions made in each question including those made by me.

I don't want to waste my time suggesting anything here if you already have this particular area covered.

mpfister provided some good general advice, but there is a difference that I have noted in my current (and very fresh) install of XP Pro SP3.  I don't know if this is something that the Windows Installer Version 3.5 SP1 (installed right at the start) has changed from the way it used to be, but here is the change I have observed.

In my case, the following registry key stores the "Add/Remove Programs" information for Microsoft Office 2003 Professional:


The "QuietUninstallString" is set with the value (ie. the command):
MsiExec.Exe /x {90110409-6000-11D3-8CFE-0150048383C9} /qn

Normally what I would look for in that key would be the value named "LocalPackage".  This actually names the *.MSI file that was created by the setup in the C:\Windows\Installer folder.  You see, the {90110409-6000-11D3-8CFE-0150048383C9} is the product identifier for my MS Office, and this is referenced elsewhere in the registry, so the above command works.

When I have problems that are caused by potentially missing or wrong cross-referneces, what I do is replace the {Product-ID-Number} in the Uninstall command with the full path to the "MSI Package", which is also the correct way to install or uninstall Windows Installer-compliant setup packages.

Now, in the key:
where I expected (as always) to see the "LocalPackage" value, it is NOT there.

However, when I back-track up to the key:


I can find the sub-key that relates to my MS Office package, namely "9040110900063D11C8EF10054038389C"

Compare the earlier one from the "Uninstall" key with this one and you will be able to see a pattern when I break it up with spaces.  Going from right to left up to the large space, you will see that each pair of characters is reversed.  Thereafter, the groups of characters are juggled around.

9011 0409 6000 11 D3     8C FE 01 50 04 83 83 C9
9040 1109 0006 3D 11     C8 EF 10 05 40 38 38 9C

OK, so in the registry key:


I have the "LocalPackage" value that tells me the *.MSI file created at setup of Office 2003 was "C:\WINDOWS\Installer\4d4251.msi".

I can use this as a QuietUninstallString command

MsiExec.Exe /x C:\Windows\Installer\4d4251.msi  /qn

instead of the following one if that doesn't work:

MsiExec.Exe /x {90110409-6000-11D3-8CFE-0150048383C9} /qn

The implications of this should be apparent by now.  If you have somehow lost the listing in Add/Remove Programs, then it is likely that this is because the required registry key and values are gone, however you MAY still have the original *.MSI file in the C:\Windows\Installer folder.

If you just open that folder and check the "Properties" for each *.msi file in there, you may discover the one for your MS Office setup.  Look under the "Summary" tab of the file's Properties dialog.

Incidentally, in the "InstallProperties" key mentioned above, you will also find a value named "InstallSource" that tells the Windows Installer where all the files for the setup were cached.  In my case this is:
C:\MSOCache\All Users\90000409-6000-11D3-8CFE-0150048383C9\

I hope this gives you an alternative to try if mpfister's command doesn't work.

Hmmm.  I have just realised I may have wasted a lot of time if you already have gone beyond this stage.  Never mind, maybe someone else may find the info useful if you don't need it.

Just in case you were wondering, the key HKEY_USERS\S-1-5-18 and all its sub-keys contain the settings for the "LocalSystem" Account/Profile.  Your own User Profile settings will be in the key starting with begins with HKEY_USERS\S-1-5-21.  There are usually two with the same numbers.  One of them ends with _Classes, but still relates to that same user profile.  The last numbers in the ID tell you something about the account:
500 is Administrator and 501 is Guest.  The one ending 1003 will be you, and the settings there will be echoed in the key HKEY_CURRENT_USER if logged on as you.  Those are the general rules anyway.  This is just to explain the HKEY_USERS\S-1-5-18 key.
get000sumitAuthor Commented:
Thank you Qlemo and get000sumit

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now