[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Removing an application using a script in a password protected installation

Posted on 2007-10-16
9
Medium Priority
?
556 Views
Last Modified: 2008-08-28
I have an application that appears under ADD/Remove programs that was installed using a password in the installation process.
This application needs to be removed for the installation of the new version and is present in over 300 computers.
We were hoping to be able to script the removal of the software using a script and Altiris.
Is there a way this can be done?
Thanks in Advance.
0
Comment
Question by:alidaher
  • 5
  • 4
9 Comments
 
LVL 65

Expert Comment

by:RobSampson
ID: 20089205
Hi, this would uninstall the product:

'============
strComputer = "."

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = bjWMIService.ExecQuery("Select * from Win32_Product WHERE Name='Application Name'")

For Each objItem in colItems
     objItem.Uninstall
End If
'============

But I've never heard of a program that requires a password for uninstallation ......

Regards,

Rob.
0
 

Author Comment

by:alidaher
ID: 20091343
I created a file called archetype_uninstall.vbs with the following content as per your suggestion :
'============
strComputer = "."

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = bjWMIService.ExecQuery("Select * from Win32_Product WHERE Name='Archetype Email Release 2006.9.017'")

For Each objItem in colItems
     objItem.Uninstall
End If
'============


It is failing with the following error:

---------------------------
Windows Script Host
---------------------------
Script:      P:\archetype_uninstall.vbs
Line:      9
Char:      1
Error:      Expected statement
Code:      800A0400
Source:       Microsoft VBScript compilation error

---------------------------
OK  
---------------------------
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 20091370
Oops, sorry!

Change
For Each objItem in colItems
     objItem.Uninstall
End If

To
For Each objItem in colItems
     objItem.Uninstall
Next

The End If should have been a Next

Regards,

Rob.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:alidaher
ID: 20091805
Now i am getting the following error :
---------------------------
Windows Script Host
---------------------------
Script:      P:\archetype_uninstall.vbs
Line:      5
Char:      1
Error:      Object required: 'bjWMIService'
Code:      800A01A8
Source:       Microsoft VBScript runtime error

---------------------------
OK  
---------------------------
0
 
LVL 65

Accepted Solution

by:
RobSampson earned 375 total points
ID: 20097342
Oh, sorry, another silly mistake....typo....
'============
strComputer = "."

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Product WHERE Name='Application Name'")

For Each objItem in colItems
     objItem.Uninstall
Next
'============

And don't forget to replace Application Name with the same name that appears in the Add / Remove programs, although I'm pretty sure you can use asterix characters either side....

Regards,

Rob.
0
 

Author Comment

by:alidaher
ID: 20099266
Ok I have ran the vbs file and it runs without complaint. However the application is still there under the appwiz.cpl
Is there a way to report on whether it has been removed or not and what the error actually is?
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 20099704
Have a look in your Event Viewer, either Application or System log.  The Uninstall method does not return anything except succesful or failed, but seeing as it's still listed, I'd say it failed....

Regards,

Rob.
0
 

Author Comment

by:alidaher
ID: 20099749
it appears it works for some applications but only removed them from the appwiz.cpl but the applications are still there in their working directories..so i am not sure it actually removes anything but the appwiz listing.
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 20106391
That's odd.....OK, before writing a script to help you with this approach, if you manually browse through the registry, through:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall

and then do a search for Archetype, you will see the product code for that as the key it is found in, which is like
{xxxx-xxxxx-xxxxxx-xxxxxx-xxxxx}

So, with that product code, can you run (at a command prompt):
msiexec /uninstall {xxxx-xxxxx-xxxxxx-xxxxxx-xxxxx}

Regards,

Rob.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question