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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing with net use in dos with Vista

Status
Not open for further replies.

SuZu01

IS-IT--Management
Feb 21, 2006
48
CA
We currently have a network mapped dos program opening with Batch files. I tryed to do "run as administrator" on the batch file to resolve the problem related to net use when I try to print, but when I do "Run as administrator" it doesn't open anything...

I can't figure out how I'll be able to print now, perhaps, I'm not the programmer of this dos program and don't known all how it's working.

Usually, I'm using "Net use lpt1 \\server_Or_computer\printer"

and after print I do a "Net use lpt1 /delete /y"

It have been working on Win95,Win98,WinXP, Win2k and 2k3, but no more working on Vista. Its actually a problem related to permissions...since we aren't in administrator mode.

Here's an example fo the "opening batch file" for our dos program.

ECHO OFF
IF EXIST G:LOGSIGEC.TXT GOTO EXIT
COPY j:LOGSIGEC.TXT G:
I:
CD 001
J:
BTRIEVE/P:2048
CALL FCS-HIST 001
DEL G:LOGSIGEC.TXT
BUTIL -STOP
I:
CD..
GOTO FIN
:EXIT
TYPE G:LOGSIGEC.TXT
PAUSE
:FIN



IT's really important since it's our accounting, inventory and all other related stuff program for now...

I only have 1 vista machine over more than 60 XP machines, but all new computers we buy are going to be VISTA business, so...


 
I just want to print to a normal LPT port, but I can't use the "net use" as usual...

I never had any problems when I was with previous version of Windows and printing to USB in DOS is still easy too in XP... The problem's related to vista, but anyway, that's not my main concern for now, I just want to print to a LPT port or Network mapped printer...
 
Are you now saying, you can't print anything, DOS or otherwise?

Network printing blocked by firewall

File and Printer Sharing in Windows Vista

Getting Started with Windows Firewall with Advanced Security
 
Sorry for confusion, my problem's only in dos and this program was used in Windows XP without any problems.

Usually we are using net use lpt1 \\computername\printer

Now it's not working and I think it's because we can't start the "CMD" prompt in Administrator mode, since the program itself is called by a batch file which we can't ask to open the prompt in Administrator.

If I try to disable the "UAC" in Vista, can this resolve my issue, I'll try to do this for test purpose.

Thank you all for your ideas.
 
I have been able to print to LPT1 ( Local printer ) but program usually use "net use lpt1 \\computername\printername\ to print to any network printers...

So my problem is that I get an error 1223 since the command prompt the program use isn't in administrator mode, so If I find a way to get all cmd prompt to open as administrator it should work.
 
If I desactivate UAC in Vista it won't let me use net use lpt1 \\computer\printer in a standard cmd prompt right ?

When I'll be able to run Net use as administrator I won't have anymore problems, but since this programe haven't been done by me and It's not a usual .exe, it's hard to make it work...

So I do need administrator level to make net use work, so should I do this in vista ?

Take in consideration that's a vista machine on a domain, so the user.
 
To launch an elevated command prompt press the Windows key, type CMD, press Ctrl+Shift+Enter, and then Alt+C to confirm the elevation prompt.
 
I already known how to start a command prompt in administration mode, the problem's that the program itself is called from a batch file that you can see on my first post, this is calling a .exe file, which is on a mapped network drive. After that, this .exe works on a dos prompt. The program's working fine, but for printing on network printers, it's using "Net use" command which isn't in administrator mode at this time... so If I had an option to make the "net" command always run as administrator, that should work....

 
Sorry, I guess I'm just dense here because I've lost the thread of what is going on here then.

The batch file gets started from an elevated command prompt?

Then this elevated batch process runs the program?

Somewhere along the line the NET USE gets done from an un-elevated environment?

Is the program itself shelling another command prompt where the NET USE is being done or something?

I'm not trying to be annoying, just trying to see the process hierarchy involved.
 
I'm trying to figure out since I'm not the developer of this program and it do have some weird concept arround this program, I do thing it's running the net use command from an un-elevated enviromment.

I tryed to run the batch file as administrator and it doesn't work at all when I do this, it's just opening and closing right after.
 
Have you tried adding the NET USE to the BAT file, adding the /PERSISTENT:YES switch To it there, and running the BAT elevated?
 
I sure hope this program does more than just printer additions to workstations and profiles - otherwise the consensus must be to ditch it and use the inbuilt Windows methods (GPO's) or a more elegant non-batch script.




Steve.

"They have the internet on computers now!" - Homer Simpson
 
Is there any ways to "start" from a batch file another batch file as administrator ?

 
Does the RunAs command work in Vista when used from a Batch file, perhaps not with UAC, I'm not really sure?

See Runas /? from a Command Prompt.
 
I have not tried it but;

Have you tried starting the first batch file elevated and then using;

CALL OtherBatchFile

within it?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top