[Legacy] Example of adding printers using WScript


PaperCut NG/MF now offer simple to use solutions that assist with the deployment and management of print queues. The first such feature was released in PaperCut NG/MF v19.1 as Print Deploy. This removes the stress and time commonly associated with managing print queues and makes their deployment a breeze!

Check out the Print Deploy Tour Page and Help Center for more information.

PaperCut NG/MF also has a fantastic option for BYOD devices called Mobility Print. It can often be difficult and frustrating to manage users on BYOD devices but Mobility Print is simple to set up, works across multiple platforms and provides a native mobile printing solution.

Check out the Mobility Print Tour page and Help Center for more information.

The information below has been kept for customers that are still managing user’s printers via scripts in tandem with PaperCut NG/MF, but may no longer be up to date.


This example was contributed by Pierre from RTIC EPL RENNES LE RHEU CFPPA RENNES-LE RHEU / CPSA COMBOURG.

This script is a variation on “Option 1” listed under [Legacy] Automating printer management in a school, university or education environment but uses a Visual Basic case statement to select the appropriate printers. Again this script takes advantage of a consistent convention assigned to workstation network names. The script uses the first three letters from the computer’s name to determine physical location.


Dim objNet 
Dim ComputerText

On Error Resume Next 

Set objNet = CreateObject("Wscript.Network")    

'our computers' name are for example : location1pc1, location1pc2,
location2pc1 etc... with 3 first letters unique

'get the 3 first letters = pc location

ComputerText = left(objNet.ComputerName,3)

select case ComputerText

	case "cdr"

		objNet.AddWindowsPrinterConnection "\\server\printer1" 
   		objNet.AddWindowsPrinterConnection "\\server\printer2" 

		'set the default printer

		objNet.SetDefaultPrinter "\\server\printer1"

	case "sip"

		objNet.AddWindowsPrinterConnection "\\server\printer1" 
   		objNet.AddWindowsPrinterConnection "\\server\printer3" 

		objNet.SetDefaultPrinter "server\printer3"

	case else

		objNet.AddWindowsPrinterConnection "\\server\printer4" 

End select

Set objNet = Nothing


PaperCut Software would like to thank Pierre for providing this example.


Categories: How-to Articles, Scripting and APIs

Comments