• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 423
  • Last Modified:

Deploying Printers without Server 2003 R2

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
fowen
Asked:
fowen
  • 5
  • 2
1 Solution
 
RobSampsonCommented:
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
 
fowenAuthor Commented:
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
 
RobSampsonCommented:
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
Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

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

Regards,

Rob.
0
 
fowenAuthor Commented:
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
 
RobSampsonCommented:
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
 
benhansonCommented:
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
 
RobSampsonCommented:
fowen, did you make any progress on this?

Regards,

Rob.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 5
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now