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

Posted on 2009-04-26
Last Modified: 2013-12-25
i want to prepare script or batch file to remove microsoft office from my machine .
Question by:get000sumit
    LVL 28

    Accepted Solution

    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.

    LVL 38

    Assisted Solution

    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.

    LVL 38

    Assisted Solution

    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.

    Author Comment

    LVL 38

    Expert Comment

    Thank you Qlemo and get000sumit

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    When you receive another warning that your shared drive is almost full and you have asked your users to clean out old files again and again, here is a single command that may help. This command will place all the files that have not been used rec…
    How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
    Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
    The viewer will learn how to count occurrences of each item in an array.

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now