home *** CD-ROM | disk | FTP | other *** search
- NWHAT - Network What
- A batch file enhancement program for Novell Networks
- Version 1.3b
- Date - 03/15/90
-
- The following copyrights and trademarks apply:
-
- NWHAT is a software product of
- Precision Data Consultants & William Stackpole
- Copyright (c) 1989. All rights reserved.
-
- Novell Advanced Netware is product of Novell, Inc.
- PC-DOS is a product of IBM, Inc.
- MS-DOS and MS-C are products of MicroSoft, Inc.
- Network Assistant is a product of
-
- Written in MicroSoft C v5.1
-
- Disclaimer:
-
- This product is supplied without any warranty of any kind with
- regard to this material including, but not limited to, the
- implied warranties of merchantability and fitness for a particular
- purpose. Precision Data Consultants shall not be liable for
- errors contained herein or for incidental or consequential damages
- in connection with furnishing, performance, or use of this product.
-
-
- NWHAT - Network What Page 2
- A batch file enhancement program for Novell Networks
- Version 1.3b
- Date - 03/15/90
-
- Purpose:
- NWHAT gets various pieces of information from a Novell network
- and returns this information to a batch process in the form of an
- error level or by writing the result to the DOS environment table
- as the NWHAT variable.
- I wrote NWHAT because I got tired of writing custom menus for
- all of my users. Seems like every workstation has a slightly
- different set up and requires a different configuration file for
- every application on the network.
- NWHAT allows dynamic branching within a batch file or Novell menu
- based on the work station and user information it can supply. It
- also allows me to edit LOGIN scripts with a text editor instead of
- going into SYSCON. It also allows me to change printer configurations
- with PRINTCON without having to log in as the user. I use NWHAT to
- login Network Assistant printer servers onto the network when the
- user logs out.
-
-
- Usage:
- NWHAT -command [argument]
-
- Running NWHAT without a proper command will produce a help screen.
-
-
- Result Codes: (General)
- NWHAT will return a error level or zero (0) if the command com-
- pleted successfully.
-
- Errors which keep the program from completing correctly return
- an error level of one (1). These errors include:
-
- "Not attach to the Network"
- "Out of Environment Space"
- "Invalid Command"
- "Invalid or Missing Argument"
-
- These errors will also produce an accompanying error message.
-
- Commands which require simple yes or no result return error levels,
- all others commands output their results to the NWHAT variable in
- the DOS environment table. If the variable does not exist it is
- created. If it does exist it is overwritten with the results of
- this command. The information written to the NWHAT variable can
- then be read by a batch file using the %NWHAT% syntax or viewed by
- entering a SET command at the DOS prompt.
-
- NWHAT - Network What Page 3
- A batch file enhancement program for Novell Networks
- Version 1.3b
- Date - 03/15/90
-
- Commands:
-
- A command must be entered with a proceeding dash (-) or slash
- (/) character. Only the first two characters of the command are
- required. Improperly entered commands cause a help screen to be
- displayed.
-
- Command Purpose
-
- -name Returns the user's LOGIN NAME.
- Returns ERRORLEVEL 2 if you are not logged in to the network.
-
- -full Returns the user's full name as entered during the MAKEUSER
- process. Spaces are translated to underscore (_) characters
- to be compatible with the operation of the SET command.
- "UNKNOWN" is returned to the environment if no full name was
- ever entered for the user.
- If no argument is entered NWHAT returns the full name of the
- user logged in at this workstation. Otherwise NWHAT will the
- return the full name of the user with that LOGIN NAME.
- Return's ERRORLEVEL 3 if no user by that LOGIN NAME exists on
- this server.
-
- -id Returns the user's mail box ID. This is the name of the sub
- directory under \MAIL on the SYS volume where the user receives
- their mail. This is also where the user's LOGIN script and
- PRINTCON configuration files are kept.
- If no argument is entered NWHAT returns the mail ID of the
- user logged in at this workstation. Otherwise NWHAT will the
- return the mail ID of the user with that LOGIN NAME.
- Return's ERRORLEVEL 3 if no user by that LOGIN NAME exists on
- this server.
-
- -station Returns the logical station number that this work station is
- attached to on the file server.
-
- -physical Returns the physical station number (usually the network
- interface card number) of this work station.
-
- -display Returns the video display type. Will return VGA, EGA, CGA, MCGA,
- MGA (Hercules) or MDA. Defaults to CGA if card type is unknown.
-
- -logged Returns ERRORLEVEL 0 if the work station is logged in to a
- file server. ERRORLEVEL 2 if the network shell has been
- loaded but the work station is not logged in.
-
- -attach Returns ERRORLEVEL 0 if the work station is attached to the file
- server specified in the argument. Returns ERRORLEVEL 2 if the
- work station is not attached to the named file server.
-
- -fserver Returns the name of the file server name mapped to the
- default disk drive or to the drive specified in the
- argument. If the drive is not mapped to a file server
- the primary file server name is returned.
- If no argument is entered the current default drive is assumed.
-
- NWHAT - Network What Page 4
- A batch file enhancement program for Novell Networks
- Version 1.3b
- Date - 03/15/90
-
- -volume Returns the name of the disk volume on the file server
- mapped to the default disk drive or to the drive
- specified in the argument.
- Returns ERRORLEVEL 2 if the drive is not mapped to a
- file server volume. If no argument is entered the
- current default drive is assumed.
-
- -map Returns the network map specification (including the
- volume name) of the default disk drive or the drive
- specified in the argument.
- Returns "LOCAL" if the drive is mapped to a local DOS
- drive. Returns ERRORLEVEL 2 if the drive is not a local
- drive and is not mapped to a file server.
-
- -netbios Returns ERRORLEVEL 0 if NETBIOS is loaded.
- Returns ERRORLEVEL 2 if NETBIOS is NOT loaded.
-
- -user Used to tell if another user is logged into this file
- server. Returns ERRORLEVEL 0 if the Login ID is valid
- and the user is presently logged in to the server.
- Returns ERRORLEVEL 2 if the Login ID is valid for this
- file server but the user is not logged in.
- Returns ERRORLEVEL 3 if the Login ID is invalid for this
- file server.
-
- -member Returns ERRORLEVEL 0 if the logged user is a member of the
- group specified in the argument. Returns ERRORLEVEL 2 if
- they are not a member of the named group.
-
-
- Additional Information:
-
- NWHAT writes the results to the "REAL" DOS environment table.
- NWHAT searches back through the running programs to find the root
- COMMAND.COM. The search technique I'm using works fine on PC-DOS v3.3
- and Vectra DOS v3.3 but I have not tested it on other versions of MS
- DOS. I adapted it from an assembly routine written by MicroSoft so it
- should be pretty reliable.
- This does mean that the results of NWHAT will NOT be written to the
- environment of a secondary COMMAND.COM! This won't be a problem if you
- are running the secondary COMMAND.COM in the single command mode
- (the /c switch). Most programs which allow you run a DOS command from
- within them (like the Dbase RUN command) use this mode. However programs
- like Lotus 123 which run a secondary COMMAND.COM will give you erroneous
- results. The NWHAT results will not appear in the environment table of
- the secondary COMMAND.COM.
- NWHAT only overwrites the results of a previous command if the current
- command completes successfully so you should always test for an error
- level of zero to make sure the NWHAT variable has been updated. This is
- particularly important when you are using commands with optional para-
- meters since these are most likely to fail from 'Invalid or Missing
- Parameter' errors.
- NWHAT - Network What Page 5
- A batch file enhancement program for Novell Networks
- Version 1.3b
- Date - 03/15/90
-
- Example batch files:
-
- Example 1: This batch file demonstrates a controlled auto login process.
-
- REM NET.BAT
-
- echo off
- cls
- Rem See if the user is attached to the network.
- NWHAT -logged
- If ERRORLEVEL 2 Goto LOGIN
- If ERRORLEVEL 1 Goto SHELL
- NWHAT -fserver
- echo This work station is attached to server %NWHAT%
- NWHAT -station
- echo as station %NWHAT%.
- NWHAT -name
- echo Login ID is %NWHAT%
- Goto END
- :SHELL
- IPX
- NET3
- :LOGIN
- LOGIN %1 %2
- :END
-
-
- Example 2: Sending and Receiving Files through mail directories
-
- This batch file transfers a file into a user's mail directory.
-
- Rem SENDMAIL.BAT
- Rem Command line Usage
- Rem SENDMAIL filename LoginID
- echo off
- cls
- NWHAT -id %2
- If ERRORLEVEL 2 GOTO NO_USER
- If ERRORLEVEL 1 GOTO NO_NET
- MAP M:=SYS:MAIL\%NWHAT%
- COPY %1 M: /V
- MAP DELETE M:
- Echo Mail file %1 delivered to MAIL\%NWHAT%.
- Goto END
- :NO_USER
- Echo %2 is not a valid User ID for this sever.
- Goto END
- :NO_NET
- Echo You must be logged into the network to send mail.
- :END
- NWHAT - Network What Page 6
- A batch file enhancement program for Novell Networks
- Version 1.3b
- Date - 03/15/90
-
- Rem VIEWMAIL.BAT
- Rem Get a directory list of the files in your Mail Box.
- echo off
- cls
- NWHAT -id
- If ERRORLEVEL 1 GOTO NO_NET
- MAP M:=SYS:MAIL\%NWHAT%
- DIR M: /P
- Pause
- MAP DELETE M:
- GOTO END
- :NO_NET
- echo You must be logged into the network to view your Mail Box files.
- :END
-
-
- Rem GETMAIL.BAT
- Rem Copy a file from your mail box to the current directory
- Rem Usage: GETMAIL filename
- echo off
- cls
- NWHAT -id
- If ERRORLEVEL 1 GOTO NO_NET
- MAP M:=SYS:MAIL\%NWHAT%
- IF NOT EXIST M:%1 GOTO NO_FILE
- COPY M:%1 /V
- MAP DELETE M:
- GOTO END
- :NO_NET
- echo You must be logged into the network to view your Mail Box files.
- Goto END
- :NO_FILE
- echo The file %1 is not in your Mail Box.
- :END
-
- Example 3: Edit a login script file without going into SYSCON
- This batch file uses the TED editor from PC Magnet
- but would work with anything else.
-
- Rem EDLOGIN.BAT
- Rem Allows SUPERVISOR (or User) to edit a LOGIN script
- Rem Usage EDLOGIN LoginID
- echo off
- NWHAT -id %1
- If ERRORLEVEL 2 GOTO NO_USER
- If ERRORLEVEL 1 GOTO NO_NET
- MAP M:=SYS:MAIL\%NWHAT%
- If NOT EXIST M:LOGIN. GOTO NO_FILE
- TED M:LOGIN.
- MAP DELETE M:
- Goto END
- :NO_FILE
- Echo There is no LOGIN script file to edit for this user.
- Goto END
- :NO_USER
-
- NWHAT - Network What Page 7
- A batch file enhancement program for Novell Networks
- Version 1.3b
- Date - 03/15/90
-
- EDLOGIN.BAT Continued
-
- Echo %2 is not a valid User ID for this sever.
- Goto END
- :NO_NET
- Echo You must be logged into the network to edit a LOGIN script.
- :END
-
- Example 4: Saving and restoring a drive map
-
-
- NWHAT -map L:
- If ERRORLEVEL 2 GOTO SET NWHAT=NONE
- If ERRORLEVEL 1 GOTO END
- Rem Sample of Program map and execution
- MAP L:=SYS:APPLICS\WS50
- L:
- WP
- IF %NWHAT%==NONE GOTO DEL_MAP
- MAP L:=%NWHAT%
- Goto END
- :DEL_MAP
- MAP DELETE %1
- :END
-
- Example 5: Keeping a NASSIST print server on line when user logs out
-
- Requires that a dummy user be set up. I use PS for my print servers.
- When the user logs out this batch file logs the print server in so
- printing can continue normally.
-
- LOGOFF.BAT
-
- echo off
- SET PS=NONE
- NWHAT -physical
- IF %NWHAT%==AA2700010100 SET PS=PS
- IF %NWHAT%==346700010100 SET PS=PS
- IF %NWHAT%==451000010100 SET PS=PS
- IF %PS%==NONE LOGOUT
- LOGIN PS
-
- Example 6: Edit a print configuration file without logging in
- as the user.
-
- Rem PCON.BAT
- Rem Allows SUPERVISOR or Group Manager to edit a user's printer
- Rem configuration without logging in as the user.
- Rem Usage PCON LoginID
- echo off
- NWHAT -id
- If ERRORLEVEL 1 GOTO NO_NET
- MAP H:=SYS:MAIL\%NWHAT%
- H:
- Copy PRINTCON.DAT PRINTCON.SAV
- NWHAT - Network What Page 8
- A batch file enhancement program for Novell Networks
- Version 1.3b
- Date - 03/15/90
-
- PCON.BAT - Continued
-
- NWHAT -id %1
- If ERRORLEVEL 2 GOTO NO_USER
- If ERRORLEVEL 1 GOTO NO_NET
- MAP M:=SYS:MAIL\%NWHAT%
- If NOT EXIST M:PRINTCON.DAT GOTO NO_FILE
- COPY M:PRINTCON.DAT
- PRINTCON
- COPY PRINTCON.DAT M:
- Goto END
- :NO_FILE
- Echo There is no printer configuration file to edit for this user.
- Goto END
- :NO_USER
- Echo %2 is not a valid User ID for this server.
- Goto END1
- :NO_NET
- Echo You must be logged into the network to edit a LOGIN script.
- Goto END2
- :END
- MAP DELETE M:
- :END1
- COPY PRINTCON.SAV PRINTCON.DAT
- :END2
-
- NWHAT - Network What Page 9
- A batch file enhancement program for Novell Networks
- Version 1.3b
- Date - 03/15/90
-
-
- License:
-
- You are free to use NWHAT for your own personal use. You
- may copy and distribute NWHAT and the accompanying documentation
- provided no fee is charge for other than the copying of the
- media. This includes posting NWHAT on Bulletin board systems
- and information services.
-
- You may NOT distribute NWHAT without the documentation and
- copyright notice. You may NOT use NWHAT in a commercial
- application without paying the license fee. You may NOT use
- NWHAT in a government application without paying the license
- fee except for the Federal government. Federal government
- agencies may use NWHAT free of charge.
-
- You may obtain a license to use NWHAT on a single file server
- by mailing a check or money order for $20.00 (US) to:
-
- Precision Data Consultants
- NE 1670 Old Belfair Hwy
- Belfair, WA 98528
-
- If you would like the latest version of NWHAT enclose an
- additional $5.00 and we will mail you the most current version.
- Either way we will put you on our mailing list and keep you up
- to date on all our products.
-
- If you feel that $20.00 is too much to ask for the use of NWHAT
- please check the pricing for other network software. If you still
- think $20.00 is unreasonable then please do not use NWHAT for
- other than personal purposes.
-
- We welcome your suggestions, questions and your bugs/
- abnormality reports, give us a call at (206) 275-5597 or
- EasyPlex a message on Compuserve (73347,3225).
-
- I would like to express my special thanks to John McCann
- Compuserve NOVUSER Sysop for helping me understand the packet
- structures for Novell calls and replies.
- ting can continue normally.
-
- LOGOFto
-