Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Script to use during logon

Posted on 2002-06-21
9
152 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
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 

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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

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…
The business world is becoming increasingly integrated with tech. It’s not just for a select few anymore — but what about if you have a small business? It may be easier than you think to integrate technology into your small business, and it’s likely…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

840 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