Cannot set default printer via .vbs script
Home › Forums › Scripting › General Scripting › Cannot set default printer via .vbs script
- This topic has 7 replies, 3 voices, and was last updated 9 years, 8 months ago by
tehcamel.
-
AuthorPosts
-
pksupportMemberMay 09, 2011 at 7:06 pm #154561I am using a VBS script to set the default printer in our Library (XP clients only):
It came courtesy of Guy Thomas:
‘ SetDefaultPrinter.vbs – Windows logon script example
‘ PrintersDefault.vbs – Set the default printer
‘ VBScript – to map a network printer
‘ Author Guy Thomas [url]http://computerperformance.co.uk/[/url]
‘ Version 1.4 – April 24th 2010
‘ —————————————————-‘
Option Explicit
Dim objNetwork, strUNCPrinter
strUNCPrinter = “\PRINTSERVER1Ricoh Laser”
Set objNetwork = CreateObject(“WScript.Network”)
objNetwork.AddWindowsPrinterConnection strUNCPrinter‘ Here is where we set the default printer to strUNCPrinter
objNetwork.SetDefaultPrinter strUNCPrinter
WScript.Echo “Check the Printers folder for : ” & strUNCPrinterWScript.Quit
‘ End of Guy’s Windows logon example VBScript. [/CODE]
This works well except that the computers have SMART Notebook installed and the SMART Notebook Printer keeps re-appearing and stops the script from setting the default printer, I presume because it comes later in the log in process. I delete it and it comes back. Can anyone provide pointers to stop this?Thanks for you time – it’s much appreciated.[CODE]’ SetDefaultPrinter.vbs – Windows logon script example
‘ PrintersDefault.vbs – Set the default printer
‘ VBScript – to map a network printer
‘ Author Guy Thomas http://computerperformance.co.uk/
‘ Version 1.4 – April 24th 2010
‘
‘
Option Explicit
Dim objNetwork, strUNCPrinter
strUNCPrinter = “\PRINTSERVER1Ricoh Laser”
Set objNetwork = CreateObject(“WScript.Network”)
objNetwork.AddWindowsPrinterConnection strUNCPrinter‘ Here is where we set the default printer to strUNCPrinter
objNetwork.SetDefaultPrinter strUNCPrinter
WScript.Echo “Check the Printers folder for : ” & strUNCPrinterWScript.Quit
‘ End of Guy’s Windows logon example VBScript. [/CODE]
This works well except that the computers have SMART Notebook installed and the SMART Notebook Printer keeps re-appearing and stops the script from setting the default printer, I presume because it comes later in the log in process. I delete it and it comes back. Can anyone provide pointers to stop this?Thanks for you time – it’s much appreciated.
-
AuthorPosts
You must be logged in to reply to this topic.