Solved

Assign printers to users in Active Dir

Posted on 2004-09-15
3
153 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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
P2V Windows NT/2000 SP4 3 1,825
Recovering backup .Qic files on Windows 7 6 2,229
Video card with drivers for Windows 2000 8 148
Cannot Upgrade Microsoft Installer on Windows 2000 29 63
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…
Each year, investment in cloud platforms grows more than 20% (https://www.immun.io/hubfs/Immunio_2016/Content/Marketing/Cloud-Security-Report-2016.pdf?submissionGuid=a8d80a00-6fee-4b85-81db-a4e28f681762) as an increasing number of companies begin to…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

831 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