Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need a script to map LPT1 for network printers

Status
Not open for further replies.

mwilliamsess

IS-IT--Management
Dec 29, 2005
12
US
I have these functions already setup and working:

Function delPrint(pname)
Set objNetwork = CreateObject("WScript.Network")
confDel = msgbox ("Do you want to remove " & pname & " ?",vbYesNo)
If confDel = 6 Then
objNetwork.RemovePrinterConnection pname
msgbox (pname & " Has Been Removed.")
Else
msgbox (pname & " Will Not Be Removed.")
End If
End Function


Function addPrint(pname)
ON ERROR RESUME NEXT
Set WshNetwork = CreateObject("WScript.Network")
WshNetwork.AddWindowsPrinterConnection pname
IF Err.Number <> 0 THEN
MSGBOX "Access Denied",16,"Denied"
ELSE
ON ERROR GOTO 0
mkDef = msgbox ("Do you want " & pname & " to be your default printer?", 292, "Default Printer Status")
If mkDef = 6 Then
WshNetwork.SetDefaultPrinter pname
msgbox ("Printer " & pname & " Installed As Default Successfully.")
Else
msgbox ("Printer " & pname & " Installed Successfully.")
End If
END IF
End Function


I need another function to map LPT1 to a printer.
 
shell out to NET USE LPT1: \\servername\printqname
might not be the most elegant but will sure as hell do the job?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top