Add-Network-Printer VBS is not working in GPO


  • Windows Server 2008 R2 standard as the printer server, 

    Windows Server 2003 domain  functional level.

    I have a vbs script to map network printers. It works on the windows 7 client wioth printer previously installed.

    I added to GPO --computer settings --windows ---startup logon . Also add it to netlogon but just won't work.

    ' Script to add printers during user logon
    On Error resume Next ' ver important otherwise users will get errors on subsequent reconnections
    ' Create the variable to hold printer connections

    Dim objNetwork
    Set objNetwork = CreateObject("WScript.Network")

    'objNetwork.RemoveWindowsPrinterConnection "\\server\printer_to_remove"
    'objNetwork.RemoveWindowsPrinterConnection "\\server\2nd_printer_to_remove"

    objNetwork.AddWindowsPrinterConnection "\\dc1\printer1"
    'objNetwork.SetDefaultPrinter "\\dc1\printer1"

    Set objNetwork = Nothing


    Please help. Can you see the vbs is correct?

    Dienstag, 23. Juli 2013 23:27


Alle Antworten