bhall
2006-11-21 15:01:02 UTC
Hello!
I'm trying to remove all versions of Adobe Acrobat Reader where the name
matches "Adobe Reader" except for "Adobe Reader for Pocket PC".
The following script works to uninstall everything matching "Adobe Reader":
---------------------------------
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colSoftware = objWMIService.ExecQuery _
("Select * from Win32_Product Where Name LIKE '%Adobe Reader%'")
For Each objSoftware in colSoftware
objSoftware.Uninstall()
Next
---------------------------------
However, I can't figure out how to exclude everything matching "Adobe Reader
for Pocket PC". I tried doing something like:
---------------------------------
("Select * from Win32_Product Where Name LIKE '%Adobe Reader%' AND NOT LIKE
'%Adobe Reader for Pocket PC%'")
---------------------------------
But that didn't work. When using WQL queries, it seems that it is difficult
if not impossible to exclude a string from your query. If anyone else has
any insights, please share. I found the following links somewhat helpful,
although I'm still not sure how to tackle this:
http://www.microsoft.com/technet/scriptcenter/topics/win2003/like.mspx,
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/like_operator.asp
Thanks in advance!
I'm trying to remove all versions of Adobe Acrobat Reader where the name
matches "Adobe Reader" except for "Adobe Reader for Pocket PC".
The following script works to uninstall everything matching "Adobe Reader":
---------------------------------
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colSoftware = objWMIService.ExecQuery _
("Select * from Win32_Product Where Name LIKE '%Adobe Reader%'")
For Each objSoftware in colSoftware
objSoftware.Uninstall()
Next
---------------------------------
However, I can't figure out how to exclude everything matching "Adobe Reader
for Pocket PC". I tried doing something like:
---------------------------------
("Select * from Win32_Product Where Name LIKE '%Adobe Reader%' AND NOT LIKE
'%Adobe Reader for Pocket PC%'")
---------------------------------
But that didn't work. When using WQL queries, it seems that it is difficult
if not impossible to exclude a string from your query. If anyone else has
any insights, please share. I found the following links somewhat helpful,
although I'm still not sure how to tackle this:
http://www.microsoft.com/technet/scriptcenter/topics/win2003/like.mspx,
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/like_operator.asp
Thanks in advance!