Solved

Deploying Printers without Server 2003 R2

Posted on 2007-11-21
9
409 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
  • 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
 
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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Issue: Unstable cursor in Windows XP and Windows runs extremely slow in that any click will bring up the Hour glass (sometimes for several seconds before giving you what you want) . Troubleshooting Process and the FINAL FIX: This issue see…
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
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 from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…

910 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now