Windows – net use and Windows 8.1

permissionsportprinterwindows 8windows 8.1

I have a script that in run by some application. The script adds a shared printer to lpt1 port, then sends a file to it so it get printed then removes the printer from the port:

Everything works fine until it is installed on a computer with recent Windows 8.1 system:

enter image description here

The message in English means: The password for [shared printer name] is incorrect, enter user name for [computer name]

It works okay when I run it manually as administrator but I'm afraid I won't be always able to do it. I'd like it to be run in a script by a program which is used by a standard user.

When I googled for "windows 8 + net use" I found that people are having various problems with it but unfortunately not any answer for my issue.

Thanks for any help!

EDIT: What I need would be:

  • a syntax for a command something like below, which would do the job:

    net use lpt1: \hostname\printer name -user:admin -password:xyz123

  • a way to change computer configuration so it didn't ask for passwords.

EDIT 2:
After some experimenting I believe now it's not Windows 8 specific problem, it was just a coincidence. I made tests on another computer with Windows 8 and there wasn't such an issue. It didn't ask me for any passwords there and happily executed the command.

I tried some solutions hinted here, checked password protected sharing (it was off),
tried running it as some user (doesn't help, any existing user and password won't work)

Still it works if I right click on CMD icon and select "Run as Administrator". Strange

Then I found this link, seems very similar to my problem
http://social.technet.microsoft.com/Forums/windows/en-US/b33638c8-1032-4775-82e2-21f457cd0b70/net-use-lpt-access-denied

I'll be trying suggestions from there – disabling lpt in device manager, trying all lpt ports possible, giving rights to some folders etc.

I've got a question now – I'm new to SuperUser, what should I do with the bounty now?

Best Answer

Run it as a Scheduled Task. You can program the password so it is not part of a script and you can run it on logon/logoff.

Related Question