Solved

Assign printers to users in Active Dir

Posted on 2004-09-15
3
156 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 84

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

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…
CTAs encourage people to do something specific to show interest in your company, product or service. Keep reading to learn why CTAs should always be thought of as extremely important, albeit small, sections of websites.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

738 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