Solved

Script to use during logon

Posted on 2002-06-21
9
149 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
 

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
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Windows 2003 Terminal Server licenses 3 336
Mystery using IF with Concatenate using MS Excel 10 659
Windows Foriegn Disk 3 130
How to install Windows 2000 network drivers 4 94
Often, people trade privacy and security for convenience. However in today's concrete jungle, this is an extremely foolish decision considering the vast amount of technologies being used against consumer interest. First off, I won't waste any time e…
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…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
I designed this idea while studying technology in the classroom.  This is a semester long project.  Students are asked to take photographs on a specific topic which they find meaningful, it can be a place or situation such as travel or homelessness.…

932 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now