home *** CD-ROM | disk | FTP | other *** search
- NWHAT - Network What
- A batch file enhancement program for Novell Networks
- Version 1.4
- Date - 09/17/90
-
- The following copyrights and trademarks apply:
-
- NWHAT is a software product of
- Precision Data Consultants & William Stackpole
- Copyright (c) 1989, 1990. All rights reserved.
-
- Portions by Cyco software (c) 1989
- Used with permission
-
- 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.
-
- 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.4
- Date - 09/17/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 (or optional) 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 printer servers onto the network when the user logs out.
-
-
- Usage:
- NWHAT -command [argument] [-vname:varname]
-
- "varname" is the name of the environment variable in which
- NWHAT results will be stored. May be up to 20 characters
- long. The default varname is NWHAT.
-
- 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"
- "VNAME length longer than limit of 20 bytes"
-
- 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.4
- Date - 09/17/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.
-
- NOTE: ERRORLEVEL 1 will be returned for all functions except
- -logged if you are not logged onto a Novell server.
-
- Command Purpose
-
- -name Returns the user's LOGIN NAME.
-
- -full Returns the user's full name as entered during the MAKEUSER
- process. Spaces are NO LONGER translated to underscores.
- Test the name by enclosing it in quotes
- (i.e. "%NWHAT%"=="Joe Smith") "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, VGAMONO, EGAMONO, CGAMONO, MCGAMONO,
- HERC (Hercules) or MDA. Defaults to UNKNOWN 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.
- Returns ERRORLEVEL 99 if the attached user is "supervisor"
- or equivalent.
-
- -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.4
- Date - 09/17/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. Returns
- ERRORLEVEL 3 if the specified group name is undefined
- on the server to which the workstation is LOGONed to.
-
-
- Additional Information:
-
- All operations are made against the "primary server" except for
- functions which involve a drive letter. Drive letter functions
- are made against the server to which the drive letter is mapped.
- The "primary server" is that server which the workstation is
- logged in to.
-
- This version of NWHAT writes the results to the parent process
- environment table. This is usually COMMAND.COM. This version
- incorporates the Cyco software environment management code for greater
- compatibility with earlier versions of DOS and the 4DOS shell.
- The search technique I used in previous version proved to be unreliable
- on any version of DOS except 3.3. I have had several requests for 4DOS
- compatibility and I hope this will provide it.
- This does mean that the results of NWHAT will NOT be written to the
- environment of the primary COMMAND.COM if you are running a secondary
- COMMAND.COM in the single command mode (the /c switch). In that case
- NWHAT will appear not to function what-so-ever!
-
- NWHAT removes the specified (or default) environment variable
- from the environment when it begins execution. If you need to
- preserve the environment variable set by a prior NWHAT execution,
- you should copy it to a different name, or specify a different name
- variable name for this execution using the -VNAME:xxx option.
- NWHAT - Network What Page 5
- A batch file enhancement program for Novell Networks
- Version 1.4
- Date - 09/17/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.4
- Date - 09/17/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.4
- Date - 09/17/90
-
- EDLOG.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 SETNONE
- If ERRORLEVEL 1 GOTO END
- Goto DOIT
- :SETNONE
- SET NWHAT=NONE
- :DOIT
- MAP L:=SYS:APPLICS\WS50
- L:
- Rem Execute the Application
- WP
- Rem Restore the Old mapping
- 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.4
- Date - 09/17/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.4
- Date - 09/17/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.
-
- Special thanks to Tom Sloan for all the Netware 386 fixes and the
- multiple server fixes. Tom also turned me on to the Cyco System code.
-
- Thanks to Cyco Systems and Bart Mellink for the fine piece of code
- to manage the parent process environment table.
- ting can continue normally.
-
- LOGOFto
-