Uninstall Office 2007 on all machines in the list


I have the machine names which has office 2007 installed.Need a way to uninstall office 2007 on these machine remotely with a script.

LVL 11
Who is Participating?
Ron MalmsteadInformation Services ManagerCommented:
First...let's a query a machine for installed software.  

strcomputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery( _
    "SELECT * FROM Win32_Product",,48)
For Each objItem in colItems
    Wscript.Echo "-----------------------------------"
    Wscript.Echo "Win32_Product instance"
    Wscript.Echo "-----------------------------------"
    Wscript.Echo "IdentifyingNumber: " & objItem.IdentifyingNumber
    Wscript.Echo "Name: " & objItem.Name
    Wscript.Echo "Version: " & objItem.Version

It's best to run these scripts from command line so you can see the output.......
cscript "C:\QueryInstalled.vbs"

You should get a list of software......  The "name" in the first code I posted has to match exactly what the system says....  For instance.... I gave you code to uninstall 'Microsoft Office Professional 2007'.....you have to see if that is what you  have....meaning..you dont' have "basic edition" or something like that.

In this code, which queries the machine...you also get a "IdentifyingNumber".  You can also use this identifying number to uninstall software via logon script.  The identifying number for 2007 PRO is "{91120000-0014-0000-0000-0000000FF1CE}"

Example batch file logon script to silenty uninstall Office 2007 Professional.
msiexec /x "{91120000-0014-0000-0000-0000000FF1CE}" /q

sometimes command line is the easiest way...

you can still do command line remotely against a bunch of machines...using psexec (http://download.sysinternals.com/Files/PsTools.zip)
Usage: http://www.microsoft.com/technet/sysinternals/utilities/psexec.mspx

Example :   psexec \\* -s -d msiexec /x {91120000-0014-0000-0000-0000000FF1CE} /q
The above command will uninstall the software from every machine in the domain silenty.
Ron MalmsteadInformation Services ManagerCommented:
strComputer = "computernamehere"

Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colSoftware = objWMIService.ExecQuery _
    ("Select * from Win32_Product Where Name = 'Microsoft Office Professional 2007'")

For Each objSoftware in colSoftware

bsharathAuthor Commented:
How can i do it for all machines in the file....
I have to scan all machines in the file and if Office 2007 found then uninstall...
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

bsharathAuthor Commented:
I get this error.

Windows Script Host
Script:      C:\Uninstall Office 2007.vbs
Line:      9
Char:      1
Error:      0x80041010
Code:      80041010
Source:       (null)

bsharathAuthor Commented:
I get this.

C:\>cscript FindSoftwares.vbs
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

C:\FindSoftwares.vbs(5, 1) (null): 0x80041010
bsharathAuthor Commented:
Any help
bsharathAuthor Commented:
Any help...
bsharathAuthor Commented:
Any help....
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.