Solved

Script to use during logon

Posted on 2002-06-21
9
153 Views
Last Modified: 2012-05-09
Hello all,
We have 2 offices that we use and some people work at both offices. During login we map network printers to LPT ports for printing from a DOS program. Anyway different people have different logon scripts to map them with different printers depending on where they are working. I am looking for something to put into the logon scripts that will ask the user which location they are at and depending on the the key they press to answer it will map them to either a printer at office 1 or a printer at office 2. Does anyone know how to do this ?

Thanks in advance
0
Comment
Question by:WiddleAvi
  • 5
  • 4
9 Comments
 
LVL 7

Accepted Solution

by:
jmiller47 earned 75 total points
ID: 7099753
@ECHO OFF

REM ** DELETE ALL MAPPED LPT PORTS

NET USE LPT1: /D
NET USE LPT2: /D

REM ** CLEAR THE SCREEN

CLS

REM ** CREATE MENU
REM ** PLEASE NOTE: THE ERRORLEVEL CHOICES MUST BE IN REVERSE ORDER TO WORK.

ECHO WHAT BUILDING ARE YOU IN?
ECHO 1. BUILDING A
ECHO 2. BUILDING B
ECHO 3. BUILDING C
CHOICE /C123
IF ERRORLEVEL 3 GOTO BUILDC
IF ERRORLEVEL 2 GOTO BUILDB
IF ERRORLEVEL 1 GOTO BUILDA

REM ** SUBROUTINES FOR MAPPING PRINTERS BASED ON BUILDING PICKED

:BUILDA
NET USE LPT1: \\SERVER1\PRINTER1
GOTO END

BUILDB
NET USE LPT1: \\SERVER2\PRINTER1
GOTO END

BUILD3
NET USE LPT1: \\SERVER1\PRINTER1
NET USE LPT2: \\SERVER2\PRINTER1
GOTO END

REM ** END SCRIPT

:END


Let me know if you cannot find a choice executable that you can use. I hope this helps.
0
 

Author Comment

by:WiddleAvi
ID: 7099765
I will try that. So would I just cut and paste that into a batch file and make the approriate changes or is there more to it ?
Thanks
0
 
LVL 7

Expert Comment

by:jmiller47
ID: 7099772
That should be it. Do you understand how it works and where to substitute what? I tried to make it as simple as possible because I don't know how familiar you are with some of these commands. If it says something like this:

'choice' is not recognized as an internal or external command, operable program, or batch file.

Then you will need to let me know and I can get the executable from the Resource Kit called CHOICE.EXE
0
Free Webinar: AWS Backup & DR

Join our upcoming webinar with experts from AWS, CloudBerry Lab, and the Town of Edgartown IT to discuss best practices for simplifying online backup management and cutting costs.

 

Author Comment

by:WiddleAvi
ID: 7099784
I understand enought where to make the changes and what the commands do. If I get that error where can I get that file ? and would I have to add it's location to the PATH line in Autoexec.bat ??
0
 
LVL 7

Expert Comment

by:jmiller47
ID: 7099790
No, if it's for a logon script then it would go in the same directory as your logon scripts.

I just looked it up. It's from the Windows 2000 Resource Kit. If you can't find the file, I'll point you to a link you can download it from the web..
0
 
LVL 7

Expert Comment

by:jmiller47
ID: 7099794
You can download it here. Let me know if you have any problems with it.

thanks

http://www.pc-pipeline.com/modules.php?op=modload&name=Downloads&file=index&req=viewsdownload&sid=2
0
 

Author Comment

by:WiddleAvi
ID: 7099798
I'll test it out on Sunday. If it works I will give you the points. Thank you very much.
0
 

Author Comment

by:WiddleAvi
ID: 7102442
It worked perfectly. Thank you. One other thing....Is it also possible to set the Windows default printer in the batch file ??
0
 
LVL 7

Expert Comment

by:jmiller47
ID: 7102483
I dont' think in a batch file, but I'll look quickly
 I'll see what I can find
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
Facebook has became the #1 social media platform. People share many funny videos there, yet you don't know how to download them? Now you can download Videos from Facebook in just 3 simple steps.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question