Contents for Out-Takes 69 Option ExplicitInstructions - Prerequisite you need to substitute your printer share for \\ Alan\HP6
- I assume that your client is later than Windows 98.
- Copy and paste the script below into notepad.
- Save the file with .vbs extension e.g. GuyPrinter.vbs
- Double click and then check the message box.
- Examine your Printers and Faxes folder for a new printer.
‘ GuyPrinter.vbs ‘ Author Guy Thomas https://computerperformance.co.uk ‘ Version 1.2 – April 3rd 2005 ‘ —————————————-‘ ‘ ‘ Purpose of script to map a network printer ‘ ****************************** Option Explicit Dim objNetwork, strPrinterPath2 strPrinterPath = "\\Alan\HP6" Set objNetwork = CreateObject("WScript.Network") objNetwork.AddWindowsPrinterConnection strPrinterPath WScript.Echo "Connected Printer: " & strPrinterPath WScript.Quit ‘ End of example VBScript ‘ GuyPrinter.vbs ‘ Author Guy Thomas https://computerperformance.co.uk ‘ Version 1.2 – April 3rd 2005 ‘ —————————————-‘ ‘ ‘ Purpose of script to map a network printer ‘ ****************************** Option Explicit Dim objNetwork, strPrinterPath strPrinterPath = "\\Alan\HP6" Set objNetwork = CreateObject("WScript.Network") objNetwork.AddWindowsPrinterConnection, strPrinterPath WScript.Echo "Connected Printer: " & strPrinterPath WScript.Quit ‘ End of example VBScript Answer 1 Option ExplicitDeclare the variable strPrinterPath not strPrinterPath2 Answer 2 No CommaobjNetwork.AddWindowsPrinterConnection, strPrinterPath ‘ GuyPrinter.vbs ‘ Author Guy Thomas https://computerperformance.co.uk ‘ Version 1.2 – April 3rd 2005 ‘ —————————————-‘ ‘ ‘ Purpose of script to map a network printer ‘ ****************************** Option Explicit Dim objNetwork, strPrinterPath strPrinterPath = "\\Alan\HP6" Set objNetwork = CreateObject("WScript.Network") objNetwork.AddWindowsPrinterConnection strPrinterPath WScript.Echo "Connected Printer: " & strPrinterPath WScript.Quit ‘ End of example VBScript [ezine/ThemesGuy/google_leader728.htm] |