Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 376
  • Last Modified:

Uninstall Office 2007 on all machines in the list

Hi,

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

Regards
Sharath
0
bsharath
Asked:
bsharath
  • 6
  • 2
1 Solution
 
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
    objSoftware.Uninstall()
Next

0
 
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...
0
 
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)

---------------------------
OK  
---------------------------
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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
Next

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.
0
 
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
0
 
bsharathAuthor Commented:
Any help
0
 
bsharathAuthor Commented:
Any help...
0
 
bsharathAuthor Commented:
Any help....
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 6
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now