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

x
?
Solved

Deploying Printers without Server 2003 R2

Posted on 2007-11-21
9
Medium Priority
?
417 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
Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

 
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 2000 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

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

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

Had a business requirement to store the mobile number in an environmental variable. This is just a quick article on how this was done.
This process allows computer passwords to be managed and secured without using LAPS. This is an improvement on an existing process, enhanced to store password encrypted, instead of clear-text files within SQL
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Suggested Courses

719 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