wyscom
asked on
Logon printer script error
I have made a vbs printer script that adds printers when a user loggs on, and we have 2 workstation that have physically attached printers that we have shared out. These printers are included in my logon printer script. On the workstations that have no printer attached then the script works fine with no errors. But when the workstations that have the printers attached try and run the script or when they logon then it comes up with a printer script error:
Script: target of the script..
Line:20
Char:1
Error: The filename, directory name, or volume label syntax is incorrect.
Code:8007007B
Source: (null)
Now if you see the code snippet i was logging into workstation2 which has a printer attached with a share name of HP2200_Admin.
So im wondering if there is a way so that no script errors occur no matter what computer you are logging into.
Script: target of the script..
Line:20
Char:1
Error: The filename, directory name, or volume label syntax is incorrect.
Code:8007007B
Source: (null)
Now if you see the code snippet i was logging into workstation2 which has a printer attached with a share name of HP2200_Admin.
So im wondering if there is a way so that no script errors occur no matter what computer you are logging into.
' Printers.vbs
' Simple VBScript to set Printers
' Version 4.0 - 24/06/08
' Author ****, ***
' Modified ****, ***
' ---------------------------------------------------------'
Option Explicit
Dim objNetwork, strUNCPrinter, strUNCPrinter1, strUNCPrinter2, strUNCPrinter3
strUNCPrinter = "\\sbs-svr01\FXDocu236"
strUNCPrinter1 = "\\sbs-svr01\hp2200"
strUNCPrinter2 = "\\workstation1\DYMO"
strUNCPrinter3 = "\\workstation2\HP2200_Admin"
Set objNetwork = CreateObject("WScript.Network")
objNetwork.AddWindowsPrinterConnection strUNCPrinter
objNetwork.AddWindowsPrinterConnection strUNCPrinter1
objNetwork.AddWindowsPrinterConnection strUNCPrinter2
objNetwork.AddWindowsPrinterConnection strUNCPrinter3
WScript.Quit
try renaking teh printer with a hyphen instead of an underscore for example hp2200-admin
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
This works fine.
Thanks mate.
Thanks mate.
if you do not mind, perhaps you can use the following in a bat file..... it is very simple and straight forward..... you need to just add the line into your login.bat.....
rundll32 printui.dll,PrintUIEntry /q /in /n "\\ServerName\PrinterName"
hope this helps.....