Jump to content

Setting the local printer as the default running alongside network printers


Recommended Posts

Posted

Hi, At our school we use two VBScripts to both add and make the appropriate printer the default. In many circumstances e.i. in offices where a local printer is present, this needs to be the default. Every now and again when the user logs on in an office where a local printer is present the default printer gets set to something random. This causes issues as some programs only print to the default printer.

 

Below is what I use to set the default printer by OU, as every office doesn't have there own OU, is there a peice of VBS that I can add to the end to make the local print the default or "anything" using port "USB001" the default for instance.

 

Set objSysInfo = CreateObject("ADSystemInfo")

strName = objSysInfo.ComputerName

 

arrComputerName = Split(strName, ",")

arrOU = Split(arrComputerName(1), "=")

strComputerOU = arrOU(1)

 

Set objNetwork = CreateObject("WScript.Network")

 

Select Case strComputerOU

Case "UsLib"

objNetwork.SetDefaultPrinter "\\presley\uslib-mono"

Case "R20"

objNetwork.SetDefaultPrinter "\\presley\r20-mono"

Case "R22"

objNetwork.SetDefaultPrinter "\\presley\r22-mono"

Case "R23"

objNetwork.SetDefaultPrinter "\\presley\r23-mono"

Case "R40"

objNetwork.SetDefaultPrinter "\\presley\r40-mono"

Posted

easieat way ive found was to just name ALL local printers Local printer and y vbs script just sets the default to whatever the default is for that area then sets the default to local printer that way if it hasnt got a local printer it fails that part leaving the default printer the normal default something like (in this partiular school the printers themselves are deployed by ad)

 

' Printers.vbs - Jonathan

Option Explicit

Dim objNetwork

on error resume next

 

Set objNetwork = CreateObject("WScript.Network")

 

objNetwork.SetDefaultPrinter "\\gateway\Photocopier (ICT Suite)"

objNetwork.SetDefaultPrinter "local printer"

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...