Logon Script: con2prt

KB Home   |   Logon Script: con2prt

This article was contributed by Frank from Rowland Medical Library

See Automatically adding/connecting printers to workstations for more examples using other methods.

We are a medical library, with 10 “reference PC’s” with printers and a lab with 19 PC’s and 3 printers. In our implementation of PaperCut (used for Print Tracking), we wanted users that sat at any one Reference PC, to be able to print to the printer that was beside it. The reality is that all the printers are connected to the network print server and not directly to any PC. In the lab there is a primary printer WHITE and two smaller printers which are pooled named RED. Patrons normally print to the large fast “WHITE” printer but can select the RED printer. Other considerations, each patron has their own account and uses that to access any PC and to print. Other notes:

  • The script I wrote requires a program from MS on their resource kit called con2prt.exe.
  • umc-donder is my DC.
  • umc-Vixen is the print server and Papercut server.
  • Reference printers are desktop printers, the name is the PC# + the Printer model
  • White is an HP 8150
  • Red is (are) HP 5N

Printers are not listed in Active Directory. Patrons can only “see” those printers loaded locally. (though they can “FIND” and add, if they are smart enough!) For lab printers the sequence is important, the last listed printer will be default!

To make this work, I wrote a small batch file which is on SYSVOL and runs at logon for all patrons. Enjoy!


 @echo off
 rem OVIDUSER printer assignment
 rem FMA 07-25-03
 ECHO assigning printer.....

 rem     Make sure local copy of con2prt.exe is there
 if not exist C:\winnt\con2prt.exe copy
 \\umc-donder\netlogon\con2prt.exe C:\winnt

 rem     Decide which reference PC 
 if %COMPUTERNAME% == UMC-REF-9KWXR C:\winnt\con2prt.exe /cd
 \\umc-vixen\S8hp6l 
 if %COMPUTERNAME% == UMC-REF-9KWXR goto end
 if %COMPUTERNAME% == UMC-REF-9KWY0 C:\winnt\con2prt.exe /cd
 \\umc-vixen\S7hp1100 
 if %COMPUTERNAME% == UMC-REF-9KWY0 goto end
 if %COMPUTERNAME% == UMC-9KWXH C:\winnt\con2prt.exe /cd
 \\umc-vixen\S6hp1100 
 if %COMPUTERNAME% == UMC-9KWXH goto end
 if %COMPUTERNAME% == UMC-97808 C:\winnt\con2prt.exe /cd
 \\umc-vixen\S5hp1100 
 if %COMPUTERNAME% == UMC-97808 goto end
 if %COMPUTERNAME% == UMC-97807 C:\winnt\con2prt.exe /cd
 \\umc-vixen\S4hp6l 
 if %COMPUTERNAME% == UMC-97807 goto end
 if %COMPUTERNAME% == UMC-9C7KM C:\winnt\con2prt.exe /cd
 \\umc-vixen\S3hp5l 
 if %COMPUTERNAME% == UMC-9C7KM goto end
 if %COMPUTERNAME% == UMC-9C7HY C:\winnt\con2prt.exe /cd
 \\umc-vixen\S2hp1100 
 if %COMPUTERNAME% == UMC-9C7HY goto end
 if %COMPUTERNAME% == GM59V C:\winnt\con2prt.exe /cd \\umc-vixen\CHEC6L

 if %COMPUTERNAME% == GM59V goto end
 if %COMPUTERNAME% == UMC-CXQFY C:\winnt\con2prt.exe /cd
 \\umc-vixen\S23hp6l 
 if %COMPUTERNAME% == UMC-CXQFY goto end
 if %COMPUTERNAME% == UMC-REF-CXQFW C:\winnt\con2prt.exe /cd
 \\umc-vixen\S22hp5l 
 if %COMPUTERNAME% == UMC-REF-CXQFW goto end

 rem    Must not be a refernce PC
 ECHO Assigning Lab printers
 C:\winnt\con2prt.exe /cd \\umc-vixen\red 
 C:\winnt\con2prt.exe /cd \\umc-vixen\white 

 :end
 Echo Printers assigned!
 @echo on


More information on con2pt.exe can be found on the Microsoft website at:

See Automatically adding/connecting printers to workstations for more examples using other methods.


Categories: Scripting

Comments

Share your findings and experience with other PaperCut users. Feel free to add comments and suggestions about this Knowledge Base article. Please don't use this for support requests.

Article last modified on January 07, 2011, at 04:03 PM
Printable View   |   Article History   |   Edit Article