We're running an old but critical DOS application on a Windows XP network. There is a printer connected to the server (Windows Server 2003) that is accessed by networked computers. To do this, we've been using the following in a batch file: c:\windows\system32\net use lpt1 \\Server\Label /y (The server is named Server and the printer is named Label).
We've now got a new Windows 7 machine that needs to access this printer, and apparently Net Use has different requirements. I'm a complete Win7 noob, but I need to make this work. The closest I've gotten is: c:\windows\system32\net use lpt1 \\Server\Label /USER:{workgroup}\{username}{password} I'm getting a system error 5 - access denied. This IS the correct user name and password for the user.
I can't disable lpt1 - there's a necessary local printer there.
Does anyone have a clue what the problem might be?

Sounds like you are trying to run the script or command without elevated privileges.

Try running the same batch file "As Administrator" and see what you get.

Even though you are sending credentials to connect to the remote resource, you may not be running the command to edit lpt1 with the correct privileges on the local machine.

Good thought, but there's only one user set up on that machine at this point - Administrator. Credentials are set up in Administrator for the Server with the user's user name and password. I'm not familiar with Windows 7, but I must be missing something. I'm not sure what else I can do to correct the privileges.

i didnt see you had an lpt1 already.

try:

net use lpt2 \\server\share

Nope. I got a message about 'Multiple connections to a server by the same user, using more than one user name...'. Dang. So close.

Well, that seems to tell me that the lpt2 is trying to configure itself, but now you have multiple connctions to the same host.

With a windows box, your machine can only be authenticated once. So, for example, if you connect to a drive share with UserA. To that machine, you are UserA. If later you try to connect to another resource (i.e. another share or port) with different credentials, it's not allowed.

As a test, can you set the permissions on the printer to EVERYONE then try the 'net use lpt2' command. This will tell you if the connection can be made at all. Then you can just concentrate on getting the user rights sorted out since that's all that would be left.

Sorry, I should have seen this. However the printer is installed, it doesn't have a Win7 driver. Research shows that there IS no Win7 driver for this printer. I assume that could cause the error message I'm receiving (Access denied). In any case, it seems that this configuration is apparently not going to work. Back to the drawing board. Thanks for your help.

The print driver will not give you an access denied. If its an HP, you can try the universal driver, or try any of the 'generic' drivers in windows.

It's a Panasonic 2130 dot-matrix that we use to print custom labels. I haven't found a specific driver for it after the XP. But then, if the driver's not causing the Access Denied error, I'm really stumped. I'm not getting a syntax error, password's correct...

Did you try setting permissions to everyone?

The printer is set shared and listed in Active Directory. The Win 7 station can print to it from other apps. Just not from the DOS app.

Can you provide the logged in user with local admin rights (to allow the remap of lpt2). If the user can print through the gui, then its not a permission issue at the printer side.

Most likely, to get the script to work, you must run as admin... this will conflict with the existing logged in credentials of the user.

Grant the user temporary admin rights to the PC to test that theory.

Actually, at this point, Administrator's the only user set up on that computer so everythings being done through that account. I've tried to remap lpt2 and lpt3 to the label printer and I get "Error 1219 - Multiple connections to the server.....". That message. Dang, so easy with XP.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.