Uninstall Excel 2007 from batch file

rjccomps used Ask the Experts™
Currently we have Excel 2007 and the Office 2003 suite installed on a lot of pc's. We created a msp file to install the new office 2007 suite which will remove office 2003 and put all 2007. If excel 2007 is installed we get an error stating admin file can't be run when its not the intial installation. I tried modifying the msp, it just doesn't work. So what I am trying to do is make a batch file that can be run to uninstall excel 2007 before installing the office 2007 package.

Thanks for the help
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®



Setup.exe /uninstall proplus

this works, but prompts for a yes or no on the uninstall.
Anyone know how to bypass this
you could try this using WMIC command line

WMIC product where name="Excel 2007" call uninstall

That probably isnt the right name to use though. To get the correct name enter it exactly as it appears in the add/remove programs list.
1. Find out the GUID of the installation of Office 2007 - from the registry where it's installed, or from the MSI itself.
2. In the MSI, find out the name of the features representing Excel. Probably ExcelFiles, but there's whole bunch of others also starting with Excel - ExcelHelpfiles,ExcelAddinFiles, etc.
3. Run msiexec /qn /i {GUID} REMOVE=feature1,feature2,...

or, if Excel is the last piece of Office 2003 that you are removing,
REMOVE=ALL, or simply msiexec /x

/qn is what will make it "quiet".

Should you be charging more for IT Services?

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!


1. Find out the GUID of the installation of Office 2003


I made an xml answer file. This worked out the best.
Please clarify what is xml answer file, and how you made it. If this is config.xml, exactly what option did you specify (the description of config.xml is at http://technet.microsoft.com/en-us/library/cc179195.aspx) . From what I know, you can specify there removing or not the previous version of Office, but not the current one, which was the question. So if you have found the way, please post, so it goes into the KB.

Also, since the question was how to make batch file, the answer should probably provide the specific command, involving the xml answer file if necessary.

Also, if you tried my suggestion and it did not work, please state that. If you did not try it, then the answer probably should be split.
I would have to agree with vadim, both his answer utilizing the product guid as well as my answer utilizing WMIC will remove the software once properly used.

Put the uninstall.xml in the same folder as your setup file. This way makes more sense for me as we push these down as sms packages.

Run this command:

setup.exe /config uninstall.xml /uninstall proplus

Your uninstall.xml contains this:

<Configuration Product="ProPlus">
<Display Level="full" CompletionNotice="NO" SuppressModal="yes" AcceptEula="yes" />
<Logging Type="standard" Path="%temp%" Template="Microsoft Office Professional Plus Setup(*).txt" />
<Setting Id="Reboot" Value="Never" />
<Setting Id="SETUP_REBOOT" Value="NEVER" />
<OptionState Id="ProductFiles" State="Local" Children="force" />


Moderator please split between vadimrapp1 xxdcmast and I. I didn't try their solutions, but they seem viable. Thanks
Thanks for the clarification. Not necessary really, but if you could spare 10 minutes, I'd appreciate if you could give little more details about the original problem, and the exact message " admin file can't be run when its not the initial installation" - was that the exact text?

The reason I'm asking is because in the previous versions of Office, it was fully possible to install, for example, Outlook as standalone product, then launch installation of full Office, and it would correctly detect that Outlook is already installed, and that would be reflected in the Custom Installation screen. Actually, this is how Installer is supposed to work if the installation is authored correctly - specifically, if Outlook feature and components are the same in both installations - the component is supposed to recognize that it's already installed by another installation. Or it was possible to install, for instance, Office Pro, and then also Office with Frontpage in order to have Frontpage as well. So it seems strange that in this case Office rejected its own feature because it was installed by another package.


When you use the command setup.exe /adminfile blahblah.msp. You are unable to install any additional office 2007 products if they are already installed. That's where thy error comes into play. By modifying that msp file and using msiexec /p newblahblah.msp , we can avoid that error message but office 2007 then leaves office 2003. This is where the config file comes in to assist in an unattentended uninstall that we can push as a package to our users. After this completes we can once again use setup.exe /adminfile blahblah.msp to install all of the selected products

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial