Discussion Locked

login scripts and batch commands

0 helpful
1 reply
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

i need to modify user login scripts so that when users log in on a client machine in a particular area of the building the login script should map LPT1 to the network printer port that is physically located in that room. i need to do this in order that users can print from some of our older dos based databases.

as an example a user may be in room n107 which has the network printer \\server\n107-laser located in it. the user can print from all windows based programs but in order to print from a dos database, the printer has to be captured to lpt1. i would like this capture to take place at login. The user then goes to room e118 which has a network printer called \\server\e118-laser physically located in it, therfore the script needs to be able to check the printer name on the client machine and in turn then capture that particular printer to lpt1.

i know that this can be achieved by using batch commands but unfortunately i do not have enough knowledge of this and i would be verygrateful for any help that you can give me:

thanks

1 reply

by joseph moore

Now, I like BAT files. I think they are still very viable in this time of GPO. I think they are remarkably flexible. I use 'em a lot for stuff!
But even a BAT file cannot tell what room you are in!

The only suggestion I can think of right now is for you to hard-code the machine names in your logon script, using an IF statement.

For example, say you have 3 workstations, WORK1, WORK2 & WORK3. Each one is in a different room (WORK1 in ROOM1 with PRINTER1, WORK2 in ROOM2 with PRINTER2, etc.), and you want whoever logs in with this login script to map LPT1 to the printer in the appropriate room.
Ok. Here is what you do.
In the login script, put the following:

if %computername% ==WORK1 net use lpt1 \\SERVER\PRINTER1
if %computername% ==WORK2 net use lpt1 \\SERVER\PRINTER2
if %computername% ==WORK3 net use lpt1 \\SERVER\PRINTER3

So, this checks the machine name. All you have to do is copy this and put in every machine name you have, and point the machine to the proper NET USE LPT1 pathing.

hope this helps

This discussion is closed to new replies.