Solved

Deploying Printers without Server 2003 R2

Posted on 2007-11-21
9
414 Views
Last Modified: 2010-03-17
We are redoing the printers at my location (400+ people) and I am having a hard time figuring out how to push them out to the users without having to sit down at each PC and setup the Printing Preferences for each user.

I set the printing preferences on the server for the specific printer but the preferences don't "roll down" to the user when the printer is mapped.  I called support on this issue and they stated that this was not possible.

My question is the following:  How do I roll out printers to a group of users with certain preferences set without Server 2003 R2?
0
Comment
Question by:fowen
[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
  • 5
  • 2
9 Comments
 
LVL 65

Expert Comment

by:RobSampson
ID: 20331719
Hi, I'm not really sure if this would do what you need, but, as a test, just remove the current printer connection, then re-add it, and if that works to "reset" the user preferences, then the following script does the same thing, removing a printer, then re-adding it.

I actually use this script to migrate server printers, but you can use for the same printer, just put the same printer path in arrPrinterShares, with the "old" and the "new being the same printer, separated by a colon symbol ( : ).

It also logs the actions to a file specified by this line:
strLogFile = "\\Ntfp\userlogins$\mccdc07_printer_changes\" & objNetwork.UserName & ".txt"

'========================
arrPrinterShares = Array( _
      "\\MCCDC07\CroydonCivic_LocalLaws1:\\MCCFSCROY\CroydonCivic_NeighborhoodServices1", _
      "\\MCCDC07\By_Laws_2300LH:\\MCCFSCROY\CroydonCivic_NeighborhoodServices1", _
      "\\MCCDC07\By_Laws_2300:\\MCCFSCROY\CroydonCivic_NeighborhoodServices1", _
      "\\MCCDC07\CroydonCivic_NeighborhoodServices1:\\MCCFSCROY\CroydonCivic_NeighborhoodServices1", _
      "\\MCCDC07\Leisure lj2430:\\MCCFSCROY\CroydonLeisure_LeisureFacilities", _
      "\\MCCDC07\Rates printer LJ 8150:\\MCCFSCROY\CroydonCivic_Rates1", _
      "\\MCCDC07\CroydonCivic_Rates1:\\MCCFSCROY\CroydonCivic_Rates1", _
      "\\MCCDC07\CroydonCivic_Waste:\\MCCFSCROY\CroydonCivic_Waste", _
      "\\MCCDC07\HP LaserJet 2100 PCL6:\\MCCFSCROY\CroydonCivic_CustomerService2", _
      "\\MCCDC07\CroydonCivic_CustomerService2:\\MCCFSCROY\CroydonCivic_CustomerService2", _
      "\\MCCDC07\HP LaserJet 2430 PCL 6:\\MCCFSCROY\CroydonCivic_Health1", _
      "\\MCCDC07\CroydonCivic_Health1:\\MCCFSCROY\CroydonCivic_Health1", _
      "\\MCCDC07\CroydonCivic_CustomerService1:\\MCCFSCROY\CroydonCivic_CustomerService1", _
      "\\MCCDC07\Croydon Civic Cust service 2300:\\MCCFSCROY\CroydonCivic_CustomerService1", _
      "\\MCCDC07\CroydonCivic_NeighborhoodServices2:\\MCCFSCROY\CroydonCivic_NeighborhoodServices2", _
      "\\MCCDC07\FX Document Centre C360 PCL 6:\\MCCFSCROY\CroydonCivic_FX_Document_Centre_C360", _
      "\\MCCDC07\FX DocuCentre-II C3000 PCL 6:\\MCCFSCROY\CroydonLeisure_FX_DocuCentre_II_C3000", _
      "\\MCCDC07\CroydonCivic_ FXDocumentCentre:\\MCCFSCROY\CroydonLeisure_FX_DocuCentre_II_C3000" _
      )

Set objNetwork = CreateObject("WScript.Network")
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colPrinters = objWMIService.ExecQuery _
    ("Select * From Win32_Printer Where Local = False")

strLogFile = "\\Ntfp\userlogins$\mccdc07_printer_changes\" & objNetwork.UserName & ".txt"
Set objOutputFile = objFSO.OpenTextFile(strLogFile, intForAppending, True)
objOutputFile.WriteLine "Logged in at: " & Now & " on " & objNetwork.ComputerName
      
On Error Resume Next
If colPrinters.Count <> 0 Then
    For Each objPrinter In colPrinters
            For intPrinter = LBound(arrPrinterShares) To UBound(arrPrinterShares)
                  strOldPrinter = Split(arrPrinterShares(intPrinter), ":")(0)
                  strNewPrinter = Split(arrPrinterShares(intPrinter), ":")(1)
                  boolManual = False
                  If Left(strOldPrinter, 7) = "MANUAL=" Then
                        boolManual = True
                        strOldPrinter = Replace(strOldPrinter, "MANUAL=", "")
                  End If
                  If UCase(objPrinter.DeviceID) = UCase(strOldPrinter) Then
                        If boolManual = True Then
                              objOutputFile.WriteLine "MANUAL: Please obtain the account code for the printing from " & objPrinter.DeviceID & " and then replace that with " & strNewPrinter & " and set the account code."
                        ElseIf objPrinter.Default = True Then
                              objNetwork.RemovePrinterConnection objPrinter.DeviceID, True, True
                              objNetwork.AddWindowsPrinterConnection strNewPrinter
                              objNetwork.SetDefaultPrinter strNewPrinter
                              objOutputFile.WriteLine "Replaced " & objPrinter.DeviceID & " with " & strNewPrinter & " and set it as default"
                        Else
                              objNetwork.RemovePrinterConnection objPrinter.DeviceID, True, True
                              objNetwork.AddWindowsPrinterConnection strNewPrinter
                              objOutputFile.WriteLine "Replaced " & objPrinter.DeviceID & " with " & strNewPrinter
                        End If                              
                  End If
            Next
            If Err.Number <> 0 Then
                  objOutputFile.WriteLine Err.Number & ": " & Err.Description & VbCrLf & objPrinter.DeviceID & " --> " & strNewPrinter
                  Err.Clear
            End If
    Next
End If
Err.Clear
On Error GoTo 0

objOutputFile.Close
Set objOutputFile = Nothing
'========================

I hope that suits your needs.  After today, I won't be available, so hopefully we can sort it out for you.

Regards,

Rob.
0
 

Author Comment

by:fowen
ID: 20331843
I am not sure if that will work for me or not.

What I need to do is roll out two specific printers to a specific group of OU's and I would also like to delete any network printers that are currently mapped to those machines.

I have figured out the Printing Preferences issue.  I just need to get these printers mapped without having to walk around to each desk.
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 20331853
OK, no problem, so to get the printers mapped, just use:

Set objNetwork = CreateObject("WScript.Network")
strNewPrinter = "\\server\printershare"
objNetwork.AddWindowsPrinterConnection "\\server\printer1"
objNetwork.AddWindowsPrinterConnection "\\server\printer2"
objNetwork.SetDefaultPrinter "\\server\printer1"

Regards,

Rob.
0
Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 
LVL 65

Expert Comment

by:RobSampson
ID: 20331855
Sorry, ignore that strNewPrinter = "\\server\printershare" line, you won't need that if you specify the share path after AddWindowsPrinterConnection....

Regards,

Rob.
0
 

Author Comment

by:fowen
ID: 20331877
Will that work in a normal login script?  I think it is a WMI code, but I have never used WMI.

Would this add a machine based printer or a user based printer?

Also, if I wanted to remove all network printers (user AND machine based) do I need to know those names?  How do I go about doing that?

Thank you for your help!
0
 
LVL 65

Accepted Solution

by:
RobSampson earned 500 total points
ID: 20332006
It should work in a normal VBS logon script, provided that WSH is running on the client machines.

Also, the MapNetworkPrinterConnection method will only apply to each user that runs the script, but as long as you run it via AD under a User Configuration Logon Script it will apply to each user anyway.

Also see this for removing all network printers:
http://www.microsoft.com/technet/scriptcenter/resources/qanda/nov07/hey1102.mspx

With a logon script though, removing "machine based" printers would be difficult because I'm not sure the code in the above article would be able to enumerate those, but you can try
   Where Local = True")
instead of
   Where Network = True")

Regards,

Rob.
0
 
LVL 12

Expert Comment

by:benhanson
ID: 20461680
Just so you know, the print server doesn't have to be R2.  If you have any R2 servers in your organization you can do this.  It's basically a schema extension in Active directory, an ADM file and a logon script.
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 20522942
fowen, did you make any progress on this?

Regards,

Rob.
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Recently, Microsoft released a best-practice guide for securing Active Directory. It's a whopping 300+ pages long. Those of us tasked with securing our company’s databases and systems would, ideally, have time to devote to learning the ins and outs…
Auditing domain password hashes is a commonly overlooked but critical requirement to ensuring secure passwords practices are followed. Methods exist to extract hashes directly for a live domain however this article describes a process to extract u…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

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