Solved

Script to use during logon

Posted on 2002-06-21
9
148 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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
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

Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
auto copy 8 610
Disk size support for operating systems 12 530
Repair old Windows 2000 boot 15 199
Can you expand C: in Windows 2000? 5 129
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…
A safe way to clean winsxs folder from your windows server 2008 R2 editions
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

707 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

19 Experts available now in Live!

Get 1:1 Help Now