Solved

Assign printers to users in Active Dir

Posted on 2004-09-15
3
151 Views
Last Modified: 2010-04-13
I have been trying to "push" network printer information to AD users using a login script.  To do that, I would remove all printers and then add them back, but am having issues.  Before I spend more time on this, I thought I would check if there is a way to push network printers to a universal AD group's workstation, so they can use a local printer or use a networked printer for the workgroup.

Anyone have instructions on doing this?

Thanks.

Steve
0
Comment
Question by:smeek
3 Comments
 
LVL 83

Expert Comment

by:oBdA
ID: 12078339
If the printer mapping can be determined by global group membership as well (ifmember doesn't work with universal groups), the easiest solution is the logon script and con2prt.exe (still works fine on XP).
Example:

====8<----[logon.cmd]----
@echo off
:: *** Delete all mapped printers:
con2prt.exe /f
:: *** Map the printers according to group membership:
ifmember.exe YourDomain\Printer01Group
if not errorlevel 1 goto EndPrinter01Group
con2prt.exe /c \\PrintServer\Printer01
:EndPrinter01Group

ifmember.exe YourDomain\Printer02Group
if not errorlevel 1 goto EndPrinter02Group
con2prt.exe /c \\PrintServer\Printer02
:EndPrinter02Group
====8<----[logon.cmd]----

How to Use Con2prt.exe to Connect to a Network Printer
http://support.microsoft.com/?kbid=181663

Zero Administration Kit
http://www.microsoft.com/ntworkstation/downloads/Recommended/Featured/NTZAK.asp

Resource Kits Free Tool Downloads: Ifmember.exe
http://www.microsoft.com/windows2000/techinfo/reskit/tools/new/ifmember-o.asp
0
 
LVL 8

Accepted Solution

by:
smeek earned 0 total points
ID: 12084997
I have written a script that works OK.  The issue is that I have it remove printers first (which causes problems with the ever changing users who add local printers).  I tried to avoid removing printers but then had problems with the script or errors that showed to users.

The script excerpt is below.

Steve

''''''''''  ''''''''''

Set oPrinters = oNet.EnumPrinterConnections
         For i = 0 to oPrinters.Count - 1 Step 2
            oNet.RemovePrinterConnection oPrinters.Item(i+1), true, true
         Next

        If Err.Number <> 0 Then
          Err.Clear
        End If



'''''''''' ADD PRINTERS '''''''''''''

        Set objUser = GetObject("WinNT://DOMAIN/" & sUser & ",user")

        For Each grp In objUser.Groups

           Select Case grp.Name
       
              Case "Accounting"
              oNet.AddWindowsPrinterConnection "\\lisa\lenny", "Lenny- Samsung ML-1450 Series PCL 6"

            Case "Legal"
              oNet.AddWindowsPrinterConnection "\\lisa\lenny", "Lenny- Samsung ML-1450 Series PCL 6"

              Case "Everyone"
              oNet.AddWindowsPrinterConnection "\\lisa\carl", "Carl- Samsung ML-1450 Series PCL 6"

              Case "Recon"
              oNet.AddWindowsPrinterConnection "\\lisa\krusty", "Krusty- HP LaserJet 4 Plus"
       
              Case "Production"
              oNet.AddWindowsPrinterConnection "\\lisa\milhouse", "Milhouse- HP LaserJet 4300 PCL 6"

              Case Else
'                wsh.echo  "No Mappings for " & grp.Name

        End Select
      
      Next

        If Err.Number <> 0 Then
          MsgBox "Error Mapping Printers: " & Err.Description
          Err.Clear
        End If



'''''''''' DONE ''''''''''
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
When we talk about DevOps toolchains, I sometimes wonder how many people really get what we’re talking about. I don’t know if it’s just semantics or tone or something else, but sometimes I think it just sounds like buzzword sausage. So it’s always …
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now