Script doesn't work with GPO

Discussion in 'Microsoft Windows 2000 Group Policy' started by Eric Hela, Mar 10, 2008.

  1. Eric Hela

    Eric Hela Guest

    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

    ----------------------------
     
    Eric Hela, Mar 10, 2008
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Chad

    GPO worked once, but now doesnt??!?

    Chad, Jul 16, 2003, in forum: Microsoft Windows 2000 Group Policy
    Replies:
    2
    Views:
    481
    Srini [MSFT]
    Jul 16, 2003
  2. Joe

    Empty GPO (GPO Denied)

    Joe, Sep 5, 2003, in forum: Microsoft Windows 2000 Group Policy
    Replies:
    0
    Views:
    1,278
  3. David Fisher [MSFT]

    Re: GPO order (2 GPO's in same OU)

    David Fisher [MSFT], Oct 30, 2003, in forum: Microsoft Windows 2000 Group Policy
    Replies:
    0
    Views:
    959
    David Fisher [MSFT]
    Oct 30, 2003
  4. Craig

    GPO shutdown script doesn't work

    Craig, Mar 28, 2005, in forum: Microsoft Windows 2000 Group Policy
    Replies:
    2
    Views:
    469
    lforbes
    Mar 29, 2005
  5. wiggum

    software installation GPO versus vbscript logon script GPO installvia WMI

    wiggum, Sep 12, 2007, in forum: Microsoft Windows 2000 Group Policy
    Replies:
    2
    Views:
    6,341
    Roger Abell [MVP]
    Sep 12, 2007
Loading...

Share This Page