Hi Guru's please help
I have a vbscript intended to uninstall Autocad Lite 2002 versions on the
network using Machine based Group policy. The script works perfect if I run
it on the PC and uninstall works perfect. When I put the script into the
Machine based GP, the last line
"objSoftware.Uninstall()" does not seem to work. I can prove that by puting
echo commands and pause along the way. I turned on GPO logging on the test
PCs but does not give me any clue. Can anyone help please?
Here is the script:
----------------
strComputer = "."
Const HKEY_LOCAL_MACHINE = &H80000002
Set WSHShell=WScript.CreateObject("WScript.Shell")
Set fs=CreateObject("Scripting.FileSystemObject")
Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\"&_
strComputer & "\root\default:StdRegProv")
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colSoftware = objWMIService.ExecQuery _
("Select * from Win32_Product Where Name = 'AutoCAD Lite 2002'")
strKeyPath = _
"Software\Microsoft\Windows\CurrentVersion\Uninstall\{91E05F90-168E-43C0-BB48-39CD0F3F2678}"
strValueName = "DisplayName"
Return = objReg.GetExpandedStringValue(HKEY_LOCAL_MACHINE,_
strKeyPath,strValueName,strValue)
' If key does exist and display name is "AutoCAD Lite 2002" then run
uninstall command
If (Return = 0) And (strValue="AutoCAD Lite 2002") And (Err.Number = 0)
Then
For Each objSoftware in colSoftware
objSoftware.Uninstall()
Next
end if
----------------------------
|