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!

VBS error in Win 2000

Status
Not open for further replies.

dgut

MIS
Feb 7, 2003
4
NO
Fact:
Win 2000 server sp3, running Terminal Services
Printer: HP LaserJet 4 (shared as; HPLJ4)
Servername: server-admin

I have a standard script that should map a printer shared from my server. When i run my script i get error in line 4 (code 7007007b)that say "file name, directory name, or volum label syntax is incorrect". I have verified that this isn't wrong. The script work fine on my winXP workstation but not local on server.

Script code:
Set WshNetwork = CreateObject("WScript.Network")
PrinterPath = "\\server-admin\HPLJ4"
PrinterDriver = "HP LaserJet 4"
WshNetwork.AddWindowsPrinterConnection PrinterPath, PrinterDriver



 
Hi,

I might have a solution. According to the wsh.chm (Windows Scripting Host Help) the syntax you're using is the syntax for Win9x machines

Description
Adds a printer connection to Windows.

Syntax
Windows NT/Windows 2000:
object.AddWindowsPrinterConnection(strPrinterPath)

Windows 95/98:
object.AddWindowsPrinterConnection(strPrinterPath, strDriverName[,strPort])

By losing the syntax for printerdriver is should work.

Greetz Hans
 
tanks for your reply.

I have tried the syntax for NT/2000. but whith the same result. It seems like the command "AddWindowsPrinterConnection" isn't work on win2000 server.

Is there someome that has tried this command on win2000 server and get it to work?


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top