Uninstalling different MS Office versions

(imported topic written by safeerahmad91)

hi,

I really appreciate if any one could help me to write fixlet which can remove MS Office versions from endpoints.

as far i know there is a uninstall string in registry for MS Office…

is it same for each version of office? & how to execute that MsiExec /X{XXXXXXXXXXXXXXXXX} /qn command from BES Server?

(imported comment written by SystemAdmin)

Think about how you would do this manually if you weren’t using add/remove programs… If you look in the registry under HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall, you’ll see a guid for each product.

The one whose “Display Name” starts with “Microsoft Office” is the one you want. Notice there’s a value called “UninstallString” which has how to uninstall it. Now, in most cases for Office, it will simply be “msiexec.exe /x {XXXXXXXXXXXXXXXXX}”.

So you could take one of two approaches to uninstall

  1. Assume you can take the name of the key under HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall whose “DisplayName” starts with “Microsoft Office” - and use that to kick off msiexec.exe /x {that guid} /qn

or

  1. Take the uninstall string of that key and if it starts with msiexec and contains /x but doesn’t already contain a /q, then add /qn at the end and kick it off. Otherwise kick it off as it is.

I would probably opt for #1 to keep things simple.

First, take a stab at writing the relevance to see if you can detect that a key exists in the registry under “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall” that has a “DisplayName” that begins with “microsoft office” if you lowercase it.

Paul

(imported comment written by K178_Emrah_Ozdemir)

this is not an answer, it would be better just write that script for us. because it is very easy for you( who has alot of experience with that script language).

but for us, it is very very very hard to find out what that script means :

(value “DisplayName” of item 0 of it as string, name of item 0 of it, value “PackageName” of key “SourceList” of item 1 of it as string, ("%22" & preceding text of first “%00” of following text of last “;” of (value “LastUsedSource” of key “SourceList” of it as string & “%00”) & “%22”) of item 1 of it, hexadecimal integer (last 4 of first 9 of name of item 0 of it)) of it whose (value “DisplayName” of item 0 of it as string = value “ProductName” of item 1 of it as string AND value “Language” of item 0 of it = value “Language” of item 1 of it) of (keys whose ((value “DisplayVersion” of it as string as version = “9” as version AND (exists match (regex “\d\d(00|01|02|03)(\w%7b4%7d)-78E1-11D2-B60F-006097C998E7$”) whose ((TRUE OR it = 1033) of hexadecimal integer (parenthesized part 2 of it)) of preceding text of first “}” of following text of first “{” of name of it)) OR (value “DisplayVersion” of it as string as version = “10” as version AND (exists match (regex “(9|A|B|C)(0|1)(11|12|13|28)(\w%7b4%7d)-6000-11D3-8CFE-0050048383C9$”) whose ((TRUE OR it = 1033) of hexadecimal integer (parenthesized part 4 of it)) of preceding text of first “}” of following text of first “{” of name of it)) OR ((value “DisplayVersion” of it as string as version = “11” as version) AND (exists match (regex “(9|A|B|C)(0|1)(11|12|13|CA|E3)(\w%7b4%7d)-6000-11D3-8CFE-0150048383C9$”) whose ((TRUE OR it = 1033) of hexadecimal integer (parenthesized part 4 of it)) of preceding text of first “}” of following text of first “{” of name of it)) OR (value “DisplayVersion” of it as string as version = “12” as version AND (exists match (regex “(9|A|B|C)(0|1)12\d\d\d\d-(0011|0012|0013|0014|002E|002F|0030|0031|0033|0035|00CA)-(\w%7b4%7d)-(0|1)000-(0|1)000000FF1CE$”) whose ((TRUE OR it = 0 OR it = 1033) of hexadecimal integer (parenthesized part 4 of it)) of preceding text of first “}” of following text of first “{” of name of it)) OR (value “DisplayVersion” of it as string as version = “14” as version AND (exists match (regex “(9|A|B|C)(0|1)14\d\d\d\d-(0011|0012|0013|0014|002F|008B|003D)-(\w%7b4%7d)-(0|1)000-(0|1)000000FF1CE$”) whose ((TRUE OR it = 0 OR it = 1033) of hexadecimal integer (parenthesized part 4 of it)) of preceding text of first “}” of following text of first “{” of name of it))) of (key “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall” of it) of (if x64 of operating system then (x32 registry; x64 registry) else registry), keys of (if (exists key “HKEY_CLASSES_ROOT\Installer\Products” of it) then (key “HKEY_CLASSES_ROOT\Installer\Products” of it) else (key “HKEY_USERS.DEFAULT\Software\Microsoft\Installer\Products” of it)) of native registry)