Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Assign printers to users in Active Dir

Posted on 2004-09-15
3
Medium Priority
?
161 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 85

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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

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…
On September 18, Experts Exchange launched the first installment of the Help Bell, a new feature for Premium Members, Team Accounts, and Qualified Experts. The Help Bell will serve as an additional tool to help teams increase question visibility.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

661 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