|
server
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Removing applications using script
I am new to scripting. I need to remove previous version of Adobe Acrobat Reader in my organization. I found the below script on the Microsoft scripting center for removing an application. Here I am trying to "Adobe Acrobat 5.0". I ran the script but it does not remove the program. You can see the name of the application is "Adobe Acrobat 5.0". This is how the name appears in Add/Remove Programs. I can find any info if this is the name I should use to remove the application. Does anyone have experience removing an application like this? How do you get the correct name? strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colSoftware = objWMIService.ExecQuery _ ("Select * from Win32_Product Where Name = 'Adobe Acrobat 5.0'") For Each objSoftware in colSoftware objSoftware.Uninstall() Next Harrison Midkiff Harrison Midkiff wrote:
Show quote > Hello: You can use this command on Windows XP or 2003 to find out the name.> > I am new to scripting. I need to remove previous version of Adobe Acrobat > Reader in my organization. I found the below script on the Microsoft > scripting center for removing an application. Here I am trying to "Adobe > Acrobat 5.0". I ran the script but it does not remove the program. You can > see the name of the application is "Adobe Acrobat 5.0". This is how the > name appears in Add/Remove Programs. I can find any info if this is the > name I should use to remove the application. > > Does anyone have experience removing an application like this? How do you > get the correct name? > > strComputer = "." > Set objWMIService = GetObject("winmgmts:" _ > & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") > > Set colSoftware = objWMIService.ExecQuery _ > ("Select * from Win32_Product Where Name = 'Adobe Acrobat 5.0'") > > For Each objSoftware in colSoftware > objSoftware.Uninstall() > Next > > Harrison Midkiff > > wmic product get | find "Adobe" If this is the first time you run wmic, it would take a while to initialize. I don't have version 5.0 on my computer. The name for Adobe Acrobat 7.0 is shown as "Adobe Reader 7.0". Yimin Wei Harrison Midkiff wrote:
> Hello: You can only use Win32_Product's Uninstall method for applications> > I am new to scripting. I need to remove previous version of Adobe Acrobat > Reader in my organization. I found the below script on the Microsoft > scripting center for removing an application. Here I am trying to "Adobe > Acrobat 5.0". I ran the script but it does not remove the program. You can > see the name of the application is "Adobe Acrobat 5.0". This is how the > name appears in Add/Remove Programs. I can find any info if this is the > name I should use to remove the application. > > Does anyone have experience removing an application like this? How do you > get the correct name? Hi that have been installed with Windows Installer. AcroRead version 5.05 is not a Windows Installer installation but a InstallShield installation, and can be uninstalled like this from a script: '--------------------8<---------------------- Set oShell = CreateObject("WScript.Shell") sRegVal = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion" _ & "\Uninstall\Adobe Acrobat 5.0\UninstallString" sARUninstall = "" On Error Resume Next sARUninstall = oShell.RegRead(sRegVal) On Error Goto 0 If sARUninstall <> "" Then ' to make the uninstall unattended, add " -y -a" sARUninstall = sARUninstall & " -y -a" oShell.Run sARUninstall, 1, True End If '--------------------8<---------------------- -- torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway Administration scripting examples and an ONLINE version of the 1328 page Scripting Guide: http://www.microsoft.com/technet/scriptcenter/default.mspx |
|||||||||||||||||||||||