KB Home | Example of adding printers using WScript
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 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.
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
'set the default printer
Set objNet = Nothing
PaperCut Software would like to thank Pierre for providing this example.