group policy to deploy printers

celtic_tigerceltic_tiger Member Posts: 41 ■■□□□□□□□□
I am looking to deploy printers automatically by department using group policy in server 2003. I am testing this solution using Microsoft’s vpc with 1 server 2k3 and 1 xp virtual machines.

I have added a printer(not a physical print device) to the server 2003 machine which does have the print manager feature installed.

I can apply group policies to the workstation all right and the login script does assign the mapped networked drives but does not seem to assign the printer!
I am using the unc path in the login script \\dc\printers name in the script which is a simple batch file.

When I enter this path from the run bar on the XP client myself it successfully connects and the printer so the path is correct but it does not work when the script tries to do the exact same thing.

I have placed a pause command at the end of my script so on the client side I get one message at the top stating

“CMD.exe was started with the above path as the as the current directory (which is the \user\scripts logon path ) UNC paths are not supported. Defaulting to windows directory.”

Net use y: \\dc\accounts (this shared folder is correctly mapped)
Net use \\dc\printer name (it says the command has completed successfully but no printer appears in the clients start\printers folder!

I have added the pushprinterconnections.exe file to the top of the .bat and also have copied this pushprinterconnections.exe file into the user\scripts\login folder for the OU’s group policy and moved it to the top of the heap etc.

Also I have used the print manager and used it to deploy the printer to the relevant OU and this is displayed correctly in the deployed printers mmc.

I have followed every guide out there but no printer is being pushed to this client.

Can anybody there feel my pain and help

Thanks

Comments

  • xenodamusxenodamus Member Posts: 758
    I'm not totally sure what's going wrong in your method, but I can tell you what we do. It's pretty simple.

    For each printer, we create a global group.

    If you want a user to have that printer, add them to the group.

    Run this VBScript at login via GPO and if they are in "X" group they will get "X" printer. If they are in "Y" group, they will get "Y" printer. Here's what the script looks like:

    On Error Resume Next
    Set WSHShell = CreateObject("WScript.Shell")
    Set WSHNetwork = CreateObject("WScript.Network")
    Set objDomain = getObject("[URL]ldap://rootDse[/URL]")
    DomainString = objDomain.Get("dnsHostName")
    UserString = WSHNetwork.UserName
    Set UserObj = GetObject("WinNT://" & DomainString & "/" & UserString)

    For Each GroupObj In UserObj.Groups
    Select Case GroupObj.Name
    'Check for group memberships and take needed action
    Case "ICU",True
    WSHNetwork.AddWindowsPrinterConnection "[URL="file://\\ntuser2x\nicep16"]\\ntuser2x\nicep16[/URL]"
    WshNetwork.SetDefaultPrinter "[URL="file://\\Ntuser2X\nicep16"]\\Ntuser2X\nicep16[/URL]"
    Case "cds",True
    WSHNetwork.AddWindowsPrinterConnection "[URL="file://\\ntuser2x\cdsp1"]\\ntuser2x\cdsp1[/URL]"
    WshNetwork.SetDefaultPrinter "[URL="file://\\Ntuser2X\cdsp1"]\\Ntuser2X\cdsp1[/URL]"


    In the script above, ICU and CDS are groups that install the printers NICEP16 and CDSP1.

    You should be able to copy and paste that with your group/printer names and roll with it if you want. The great part about it is that you can use one script for the entire organization. Just add all the groups and printers in there. Group names are case sensitive btw.
    CISSP | CCNA:R&S/Security | MCSA 2003 | A+ S+ | VCP6-DTM | CCA-V CCP-V
Sign In or Register to comment.