locked
Uninstall Office 2013 via WMIC RRS feed

  • Question

  • Hey all,

    So to start I was set to Deploy New Office 2013, thing is 2013 comes with either 32 bit or 64 bit. My Goal was to get all 64 bit O/S's in our Domain to get 64 bit Office '13 and 32 bit O/S's to get the 32 bit Office '13.

    My basic plan of running a super simple batch script of "\\path\to\officex64\setup.exe /config" config.xml || \\path\to\officex86\setup.exe" /config config.xml worked when deploying to 32 bit systems since the 64 one failed (as expected) and ran the 32 bit installer as the double pipe is designed to do.

    Problem 64 deployment failed stating it can't uninstall 32 bit Office, even with msp file in update folder set to uninstall old office versions and begins the 32 bit installation as the first command failed.

    My Idea was to set a beginning part of the script to uninstall old 2007 office products, which seemed to work for both office pro and visio pro 2007. however when I run the script to uninstall office 2013 32 bit, it returns execution successful like it did with 2007 but doesn't actually uninstall, I need this part to work for 64 bit machines that currently have 32 bit office 2013 installed.

    Is this possible what am i missing?

    My script to uninstall is like like this:

    @echo off

    for /f "tokens=*" %%a in (\\path\to\list\32OfficeProducts.txt) do (

    wmic product get name | findstr /C:%%a && wmic product where name=%%a call uninstall /nointeractive || product not found nothing to uninstall

    )

    pause

    it works good, but when when i manually just run wmic product where name="Microsoft Office Professional Plus 2013" call uninstall /nointeracive

    replies execution success Return Value 1603 (just like Visio 2007 which worked) but still installed...

    ideas?

    Friday, May 24, 2013 4:31 PM

Answers

  • To anyone following this thread, i managed a scripted batch solution to the problem... I ran it manually as admin and worked fine, So I'm assuming it will work once placed as a startup script in a GPO, but will verify today... here are my scripts..

    (Config xml are setup for silent installs, and also have custom msp files in the updates folder)

    OfficePreInstallCheck.bat

    @echo off
    if "%PROCESSOR_ARCHITECTURE%" == "x86" (
        "\\path\to\Microsoft Office 2013 x86\setup.exe" /config config.xml
    ) else (
        "\\Path\to\Office13InstallerScripts\OfficeUnInstall.bat" && "\\Path\to\64bit\Microsoft Office 2013\setup.exe" /config config.xml
    )

    OfficeUnInstall.bat

    @echo off
    set meme="Microsoft Office Professional Plus 2013"
    set meme2="Microsoft Visio Standard 2013"
    for /f "tokens=*" %%a in (\\path\to\Office13InstallerScripts\OfficeProducts.txt) do (
            if %%a == %meme% (
                echo %%a selected checking if installed && wmic product get name | findstr /C:%%a && "\\Path\to\Microsoft Office 2013 x86\setup.exe" /uninstall ProPlus /config config.xml && ping 127.0.0.1 -n 120 > NUL|| echo %%a not installed skipping
            )
            if %%a == %meme2% (
                echo %%a selected checking if installed && wmic product get name | findstr /C:%%a && "\\Path\to\Microsoft Visio 2013 x86\setup.exe" /uninstall VisStd /config config.xml && ping 127.0.0.1 -n 120 > NUL || echo %%a not installed skipping
            ) else (
        wmic product get name | findstr /C:%%a && wmic product where name=%%a call uninstall /nointeractive && ping 127.0.0.1 -n 120 > NUL || echo Product %%a is not installed, nothing to do
    )
    )

    OfficeProducts.txt

    "Microsoft Office Professional Plus 2007"
    "Microsoft Office Visio Professional 2007"
    "Microsoft Office Professional Plus 2013"
    "Microsoft Visio Standard 2013"

    Tested and verified via GPO, for removal of all previous installation of 32 bit applications of Office as listed in OfficeProducts.txt, and install 64bit Office 13. hope this helps others!

    Quick Edit, It appears that Visio Standard 2013 falls under the same boat as Office 2013 as WMIC fails to uninstall the application even though it returns a execution succeeded message and has to be uninstalled the same was as Office 2013 with a conifg xml consifured for silent install, then call setup.exe /uninstall VisStd /config config.xml


    • Marked as answer by Zewwy Monday, May 27, 2013 6:32 PM
    • Edited by Zewwy Tuesday, May 28, 2013 3:57 PM
    Monday, May 27, 2013 4:31 PM

All replies

  • To anyone following this thread, i managed a scripted batch solution to the problem... I ran it manually as admin and worked fine, So I'm assuming it will work once placed as a startup script in a GPO, but will verify today... here are my scripts..

    (Config xml are setup for silent installs, and also have custom msp files in the updates folder)

    OfficePreInstallCheck.bat

    @echo off
    if "%PROCESSOR_ARCHITECTURE%" == "x86" (
        "\\path\to\Microsoft Office 2013 x86\setup.exe" /config config.xml
    ) else (
        "\\Path\to\Office13InstallerScripts\OfficeUnInstall.bat" && "\\Path\to\64bit\Microsoft Office 2013\setup.exe" /config config.xml
    )

    OfficeUnInstall.bat

    @echo off
    set meme="Microsoft Office Professional Plus 2013"
    set meme2="Microsoft Visio Standard 2013"
    for /f "tokens=*" %%a in (\\path\to\Office13InstallerScripts\OfficeProducts.txt) do (
            if %%a == %meme% (
                echo %%a selected checking if installed && wmic product get name | findstr /C:%%a && "\\Path\to\Microsoft Office 2013 x86\setup.exe" /uninstall ProPlus /config config.xml && ping 127.0.0.1 -n 120 > NUL|| echo %%a not installed skipping
            )
            if %%a == %meme2% (
                echo %%a selected checking if installed && wmic product get name | findstr /C:%%a && "\\Path\to\Microsoft Visio 2013 x86\setup.exe" /uninstall VisStd /config config.xml && ping 127.0.0.1 -n 120 > NUL || echo %%a not installed skipping
            ) else (
        wmic product get name | findstr /C:%%a && wmic product where name=%%a call uninstall /nointeractive && ping 127.0.0.1 -n 120 > NUL || echo Product %%a is not installed, nothing to do
    )
    )

    OfficeProducts.txt

    "Microsoft Office Professional Plus 2007"
    "Microsoft Office Visio Professional 2007"
    "Microsoft Office Professional Plus 2013"
    "Microsoft Visio Standard 2013"

    Tested and verified via GPO, for removal of all previous installation of 32 bit applications of Office as listed in OfficeProducts.txt, and install 64bit Office 13. hope this helps others!

    Quick Edit, It appears that Visio Standard 2013 falls under the same boat as Office 2013 as WMIC fails to uninstall the application even though it returns a execution succeeded message and has to be uninstalled the same was as Office 2013 with a conifg xml consifured for silent install, then call setup.exe /uninstall VisStd /config config.xml


    • Marked as answer by Zewwy Monday, May 27, 2013 6:32 PM
    • Edited by Zewwy Tuesday, May 28, 2013 3:57 PM
    Monday, May 27, 2013 4:31 PM
  • Hi,

    Glad to hear the issue was resolved. Thank you for sharing the solution.


    Tracy Cai
    TechNet Community Support

    Tuesday, May 28, 2013 2:46 AM