Jump to content

Recommended Posts

Posted

Googling here but can't seem to find the correct link to get RIC's printer script post up, did find this :

 

http://www.edugeek.net/forums/scripts/968-script-delete-all-network-printers-logoff.html

 

Where @Geoff posted the link to Ric's printer post / thread but when I click on the link it takes me to the edugeek home page

 

EduGeek.net - The I.T. Professionals' life line

 

Asking as I originally attached a script to the same post / thread and trying to get that ( as in the vbscript that I attached to Ric's post ) back

 

Thanks

  • 1 month later...
Posted

Is this it?

 

' Script to add network printers to workstations for staff
'
' Author: Ric Charlton, 07/07/04 (amended 10/02/11 by Derek Troughton)
'                                     
' Declare variables and enumerate existing printer connections
On Error Resume Next

Set WshShell = WScript.CreateObject("WScript.Shell")
Set WshNetwork = WScript.CreateObject("WScript.Network")
Set oPrinters = WshNetwork.EnumPrinterConnections

Dim computerName
computerName = LCase(WshNetwork.ComputerName)


' Debugging line> WScript.Echo "ComputerName variable: " & computerName

' Delete existing connections to network printers
For i = 0 to oPrinters.Count - 1 Step 2
           On Error Resume Next
	if Left(oPrinters.Item(i), 3) <> "lpt" And Left(oPrinters.Item(i), 3) <> "usb" then
            	WshNetwork.RemovePrinterConnection oPrinters.Item(i+1), true, true
           else WScript.Echo "No network printers found"
           end if
Next

' Add printer connections dependant upon location
Select Case (Left(computerName, 3))
Case "lrc"
	WshNetwork.AddWindowsPrinterConnection "\\norden-printers\LRC-Mono"
	WshNetwork.SetDefaultPrinter "\\norden-printers\LRC-Mono"
Case "lib"
	WshNetwork.AddWindowsPrinterConnection "\\norden-printers\LRC-Mono"
	WshNetwork.SetDefaultPrinter "\\norden-printers\LRC-Mono"
Case "lea"
	WshNetwork.AddWindowsPrinterConnection "\\norden-printers\LRC-Mono"
	WshNetwork.SetDefaultPrinter "\\norden-printers\LRC-Mono"
Case "MED"
	WshNetwork.AddWindowsPrinterConnection "\\norden-printers\English-Mono"
	WshNetwork.SetDefaultPrinter "\\norden-printers\English-Mono"
Case "rep"
	WshNetwork.AddWindowsPrinterConnection "\\norden-printers\AB-Colour"
	WshNetwork.SetDefaultPrinter "\\norden-printers\AB-Colour"

Case Else
	' WScript.Echo "No default printers added"
End Select

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...