Announcement

Collapse
No announcement yet.

Printer scripts do not work through GPO on PC's with XP SP2

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Printer scripts do not work through GPO on PC's with XP SP2

    Hi,

    We are currently having a problem with our printer scripts applied through logon scripts in GPO.

    The script works on all clean build pcís with no updates, SP1 installed, SP1 plus updates but not XP SP2

    A typical printer script that fails (printmap.vbs) is as below :-

    -----------------------------------------------------------------
    strComputer = "."
    Set objWMIService = GetObject("winmgmts:")
    Set objNewPort = objWMIService.Get _
    ("Win32_TCPIPPrinterPort").SpawnInstance_
    objNewPort.Name = "IP_10.39.10.45"
    objNewPort.Protocol = 1
    objNewPort.HostAddress = "10.39.10.45"
    objNewPort.PortNumber = "9100"
    objNewPort.SNMPEnabled = False
    objNewPort.Put_

    strComputer = "."
    Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
    Set objPrinter = objWMIService.Get("Win32_Printer").SpawnInstance_
    objPrinter.DriverName = "HP Color LaserJet 4600 PCL 6"
    objPrinter.PortName = "IP_10.39.10.45"
    objPrinter.DeviceID = "HP Colour LJ 4600"
    objPrinter.Location = "CSC"
    objPrinter.Network = True
    objPrinter.Shared = False
    objPrinter.ShareName = "HPLJ4600"
    objPrinter.Put_

    --------------------------------------------------------------------

    This vbs script is called from a batch file in GPO containing the following:-

    ------------------------------------------------------------------------------------
    c:\windows\system32\cscript \\ms01\printers\printmap.vbs
    ------------------------------------------------------------------------------------


    When the vbs script runs it errors at line 10 (objNewPort.Put_) the error message is too quick to be read.

    If the vb script is run manually by the logged in user the script completes with no problems.

    Itís a 2003 domain and all clients are XP SP2.



    Any ideas anyone ??

  • #2
    Re: Printer scripts do not work through GPO on PC's with XP SP2

    Does it work with the windows firewall disabled on SP2?

    Comment


    • #3
      Re: Printer scripts do not work through GPO on PC's with XP SP2

      Hi

      It makes no difference if the firewall is on or off, tested with no result.

      Comment


      • #4
        Re: Printer scripts do not work through GPO on PC's with XP SP2

        try adding some error handling.
        see the following example:

        http://www.computerperformance.co.uk/ezine/ezine54.htm

        for example (not tested!)

        Code:
        on error Resume next
        strComputer = "."
        Set objWMIService = GetObject("winmgmts:")
        Set objNewPort = objWMIService.Get _
        ("Win32_TCPIPPrinterPort").SpawnInstance_
        objNewPort.Name = "IP_10.39.10.45"
        objNewPort.Protocol = 1
        objNewPort.HostAddress = "10.39.10.45"
        objNewPort.PortNumber = "9100"
        objNewPort.SNMPEnabled = False
        objNewPort.Put_
        
        If Err.Number <> "0" Then
            Wscript.echo "Error number " & Err.Number 
            Err.Clear
            wscript.sleep 1000
             wscript.quit (0)
        end if
        
        strComputer = "."
        Set objWMIService = GetObject("winmgmts:" _
        & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
        Set objPrinter = objWMIService.Get("Win32_Printer").SpawnInstance_
        objPrinter.DriverName = "HP Color LaserJet 4600 PCL 6"
        objPrinter.PortName = "IP_10.39.10.45"
        objPrinter.DeviceID = "HP Colour LJ 4600"
        objPrinter.Location = "CSC"
        objPrinter.Network = True
        objPrinter.Shared = False
        objPrinter.ShareName = "HPLJ4600"
        objPrinter.Put_
        
        If Err.Number <> "0" Then
            Wscript.echo "Error number " & Err.Number 
            Err.Clear
            wscript.sleep 1000
             wscript.quit (0)
        end if
        but i can imaginge that de _ gives the problem in youre following lines objNewPort.Put_ & objPrinter.Put_
        Marcel
        Technical Consultant
        Netherlands
        http://www.phetios.com
        http://blog.nessus.nl

        MCITP(EA, SA), MCSA/E 2003:Security, CCNA, SNAF, DCUCI, CCSA/E/E+ (R60), VCP4/5, NCDA, NCIE - SAN, NCIE - BR, EMCPE
        "No matter how secure, there is always the human factor."

        "Enjoy life today, tomorrow may never come."
        "If you're going through hell, keep going. ~Winston Churchill"

        Comment


        • #5
          Re: Printer scripts do not work through GPO on PC's with XP SP2

          Hi

          Thanks for the error trap.

          The Error is 2147217404 Access denied even though the users are a member of local administrators. This seems to be a security lockdown with WMI.

          Because of security changes, you may receive "access denied" error messages when you access WMI in Microsoft Windows XP SP2. You may also have problems when you access a non-Windows XP SP2-based computer from a Windows XP SP2-based computer if you use an asynchronous query.

          http://support.microsoft.com/?kbid=875605

          Anyone managed to work around this? We have 1200 pc's and 2000 users using hundreds of printers.

          Derek

          Comment

          Working...
          X