E
Eric Hela
Please help gurus,
The script below works well if I run it on my desktop. works out perfectly.
When I put it in the group policy, it doesn't work. I insert echo at
different locations to step through the script when the PC boots and applies
the policy. When it comes to the "For each" statement it seems jump out
without stepping through all the installed products. I can see the script
steping through echo out product code one at a time. Then for some reason it
doesn't complete and jumps out and displays "Finished Script". I could see
the product code "{91E05F90-168E-43C0-BB48-39CD0F3F2678}" exist but script
did not pick this up. Could this be anything to do with how group policy
handles the script? Attached is the script. I am running this in windows XP
SP2 under windows 2000 Domain.
script
----------------
Const RemoveProCode = "{91E05F90-168E-43C0-BB48-39CD0F3F2678}"
Const msiINSTALLSTATEABSENT = 2
Const msiInstallStateLocal = 3
Const msiInstallStateSource = 4
Const msiInstallStateDefault = 5
Const MsiRemoveSilent = 2
Set oInstaller = Wscript.CreateObject("WindowsInstaller.Installer")
Set oProducts = oInstaller.Products
WScript.Echo "starting soon"
For Each sProdCode in oProducts
WScript.Echo SProdCode
If (sProdCode = RemoveProCode) then
WScript.Echo "Found and removing now"
OInstaller.UIlevel = MsiRemoveSilent
oInstaller.ConfigureProduct sProdCode, 0, msiINSTALLSTATEABSENT
WScript.Echo "successfully removed"
Exit For
End If
Next
WScript.Echo "Finished script"
Set oProducts = Nothing
Set oInstaller = Nothing
The script below works well if I run it on my desktop. works out perfectly.
When I put it in the group policy, it doesn't work. I insert echo at
different locations to step through the script when the PC boots and applies
the policy. When it comes to the "For each" statement it seems jump out
without stepping through all the installed products. I can see the script
steping through echo out product code one at a time. Then for some reason it
doesn't complete and jumps out and displays "Finished Script". I could see
the product code "{91E05F90-168E-43C0-BB48-39CD0F3F2678}" exist but script
did not pick this up. Could this be anything to do with how group policy
handles the script? Attached is the script. I am running this in windows XP
SP2 under windows 2000 Domain.
script
----------------
Const RemoveProCode = "{91E05F90-168E-43C0-BB48-39CD0F3F2678}"
Const msiINSTALLSTATEABSENT = 2
Const msiInstallStateLocal = 3
Const msiInstallStateSource = 4
Const msiInstallStateDefault = 5
Const MsiRemoveSilent = 2
Set oInstaller = Wscript.CreateObject("WindowsInstaller.Installer")
Set oProducts = oInstaller.Products
WScript.Echo "starting soon"
For Each sProdCode in oProducts
WScript.Echo SProdCode
If (sProdCode = RemoveProCode) then
WScript.Echo "Found and removing now"
OInstaller.UIlevel = MsiRemoveSilent
oInstaller.ConfigureProduct sProdCode, 0, msiINSTALLSTATEABSENT
WScript.Echo "successfully removed"
Exit For
End If
Next
WScript.Echo "Finished script"
Set oProducts = Nothing
Set oInstaller = Nothing