Remotely Uninstall All Microsoft Office Installations in Domain, with one single command

As seen in the previous post, I came across a way to remotely uninstall applications across my domain computers, with a single command, remotely and silently.  This would have been incredibly useful when i was updating my users to Microsoft Office 2007.  Previously, I used a remote uninstall tool, one at a time, to uninstall the various versions of office that were installed here at Big Blue.  It took alot of time, because of the numerous different versions installed. example:

  • Microsoft Office 2007 Standard
  • Microsoft Office 2007 Service Pack 2 (SP2)
  • Microsoft Office 2003 Basic
  • Microsoft Office 2003 Outlook
  • Microsoft Office 2007 Enterprise
  • Microsoft Office 2007 Project Professional
  • Microsoft Office 2007 Visio Professional
  • Microsoft Office 2000 Professional
  • Microsoft Office 2003 Professional
  • Microsoft Office 2000
  • Microsoft Office 2003 Visio Standard
  • Microsoft Office 2007 Basic
  • Microsoft Office 2007 Visual Web Developer
  • Microsoft Office 2003 Standard
  • Microsoft Office 2007 Visio Viewer
  • Microsoft Office 2007 SharePoint Designer
  • Microsoft Office 2003 PowerPoint
  • Microsoft Office 2003 Word Viewer
  • Microsoft Office 2003 PowerPoint Viewer
  • Microsoft Office 2007 SharePoint Server
  • Microsoft Office 2003 Web Components

Yea, i didn’t feel like building a script to uninstall all that crap, so NOW, i know i can uninstall all that with a single command, provided i have a list of all the computers i want to uninstall from, which can be had by using “net view”, copying and pasting into a text file.

so yea, here it is, the one command that could have saved me hours of work:
for /f %n in (all-domain-pcs.txt) do wmic /NODE:%n product where "name like '%Microsoft Office%'" call uninstall
Like the Java remote uninstall, it is not very fast, but it is effective, and beats uninstalling each, one at a time.

I  highly recommend giving it a test run using the following to see what the wildcard is going to catch:

for /f %n in (all-domain-pcs.txt) do wmic /NODE:%n product where "name like '%Microsoft Office%'" get name

Disclaimer:  Use this at your own risk.  I will not be held responsible if you manage to uninstall everything from your domain computers.

Did you like this? Share it:
This entry was posted in Tips and tricks. Bookmark the permalink.

8 Responses to Remotely Uninstall All Microsoft Office Installations in Domain, with one single command

  1. Marke says:

    Wow, great article, cannot believe I have missed this simple WMI command line tool from Microsoft.
    Saved me loads of time.

  2. Hardeep says:

    I tried tunning the script but getting error like: The system cannot find the file all-domain-pcs.txt. Kindly suggest

    • dustin says:

      you need a listing of computers in a text file in the same directory you are running from. when you open a command line, it starts in c:usersusername, so you would need to create a txt file from from notepad or whatever else you please, and have it contain a list of computers you want to run the uninstaller against, example:

      sales01
      sales02
      sales03
      acct01
      acct02
      acct03
      “hr-01”
      “hr-02”

      (yes the quotes are required if there is a dash in the system name)
      then save that as c:usersusernameall-domain-pcs.txt

      also note, for some reason, my blog platform automatically converted the first single quote, i’ll try to repost:

      for /f %n in (all-domain-pcs.txt) do wmic /NODE:%n product where "name like '%Office 200%'" call uninstall

  3. Shawn Lewis says:

    Great stuff! Thanks!

  4. Manuel says:

    Great, thanks for this excellent tip!!

  5. Jason says:

    When I run the command the command it says ” for – alias not found”

    • dustin says:

      Jason, i just ran into this the other day, and i’m pretty sure you have to remove the leading backslashes from the file with the list of computers.

      • jay says:

        can you give me details on how to remotely uninstall just visio standard 2010 and projects standard 2010 from a number odf machines in a domain

Leave a Reply

Your email address will not be published. Required fields are marked *