I am trying to make a script that i can easily send to a client to connect to
printers on the network.
So far its gone well and im able to run the script on my computer and
connect to the printer.
But the issue im having is when i have a client come into the network that
are not on the domain, or when i have computers that will never be on the
domain and happen to get reset and lose there privilages to a printer.
How do i add a username and pass into the script so it will authenticate and
allow the computer to connect to the printer?
' PrintersLong.vbs - Windows Logon Script.
' VBScript - Connect a network printer with AddWindowsPrinterConnection
' VBScript - Set Printer to default with SetDefaultPrinter
' Author Eric Heyn http://www.wctv6.com
' Version 1.1 - May 15th 2007
'
------------------------------------------------------------------------------
Dim objNetwork, strUNCPrinter, strTrueName, strPrinterName, strError,
strOption, strTitle
strTitle = "WCTV Printer Connect V1.1"
StrOption = Inputbox ("Select Printer Desired", StrTitle)
If StrOption = 1 Then strTruename = "weather-office"
If StrOption = 1 Then strPrinterName = "HP Weather"
If (StrOption < 1) Or (StrOption > 1) Then strError = "1"
If StrError = 1 Then Msgbox "Invalid Choice please restart", vbOKOnly,
strTitle
If StrError = 1 Then WScript.Quit
strUNCPrinter = "\\" & strTrueName & "\" & strPrintername
Set objNetwork = CreateObject("WScript.Network")
objNetwork.AddWindowsPrinterConnection strUNCPrinter
objNetwork.SetDefaultPrinter strUNCPrinter
Msgbox "Printer :" & strTrueName & ": added as default", vbOKOnly, strTitle
WScript.Quit
' End of Eric's Windows printer script.
' Next Version Add "Make Default? Yes/No"
' Next Version Pull Printer True ShareName and Display It
' Added Msgbox
' Added Title.
' Added Inputbox with HP Printer as 1
' Added Inputbox error message with quit command