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. Sarah G.

    Re: Login script doesn't run in GPO

    Sarah G., Jul 15, 2003, in forum: Microsoft Windows 2000 Group Policy
    Replies:
    1
    Views:
    746
    Robert Cohen
    Jul 15, 2003
  2. Joe

    Empty GPO (GPO Denied)

    Joe, Sep 5, 2003, in forum: Microsoft Windows 2000 Group Policy
    Replies:
    0
    Views:
    1,478
  3. Jérôme Poudou

    Assigning Office XP from GPO doesn't work...

    Jérôme Poudou, Sep 19, 2003, in forum: Microsoft Windows 2000 Group Policy
    Replies:
    2
    Views:
    201
    Jérôme Poudou
    Sep 21, 2003
  4. Jerin May

    User GPO applies/Computer GPO Doesn't

    Jerin May, Dec 5, 2003, in forum: Microsoft Windows 2000 Group Policy
    Replies:
    3
    Views:
    1,040
    Brian Desmond [MVP]
    Dec 8, 2003
  5. Raphael Pigulla

    GPO doesn't work

    Raphael Pigulla, Jan 30, 2004, in forum: Microsoft Windows 2000 Group Policy
    Replies:
    4
    Views:
    247
    Chriss3
    Feb 1, 2004
  6. Guest

    changes with GPO editor doesn't change GPO files on disk!!!

    Guest, Nov 5, 2004, in forum: Microsoft Windows 2000 Group Policy
    Replies:
    0
    Views:
    453
    Guest
    Nov 5, 2004
  7. Craig

    GPO shutdown script doesn't work

    Craig, Mar 28, 2005, in forum: Microsoft Windows 2000 Group Policy
    Replies:
    2
    Views:
    534
    lforbes
    Mar 29, 2005
  8. 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,574
    Roger Abell [MVP]
    Sep 12, 2007
Loading...