home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PROGRAMS / UTILS / NOVELL / NWHAT1.ZIP / NWHAT3.DOC next >
Encoding:
Text File  |  1990-07-14  |  15.3 KB  |  453 lines

  1. NWHAT - Network What
  2. A batch file enhancement program for Novell Networks
  3. Version 1.3b
  4. Date  - 03/15/90
  5.  
  6. The following copyrights and trademarks apply:
  7.  
  8. NWHAT is a software product of
  9.   Precision Data Consultants & William Stackpole
  10.   Copyright (c) 1989.   All rights reserved.
  11.  
  12. Novell Advanced Netware is product of Novell, Inc.
  13. PC-DOS is a product of IBM, Inc.
  14. MS-DOS and MS-C are products of MicroSoft, Inc.
  15. Network Assistant is a product of 
  16.  
  17. Written in MicroSoft C v5.1 
  18.  
  19. Disclaimer:
  20.  
  21.   This product is supplied without any warranty of any kind with
  22. regard to this material including, but not limited to, the
  23. implied warranties of merchantability and fitness for a particular
  24. purpose.  Precision Data Consultants shall not be liable for
  25. errors contained herein or for incidental or consequential damages
  26. in connection with furnishing, performance, or use of this product.
  27.  
  28.  
  29. NWHAT - Network What                                      Page 2
  30. A batch file enhancement program for Novell Networks
  31. Version 1.3b
  32. Date  - 03/15/90
  33.  
  34. Purpose:
  35.   NWHAT gets various pieces of information from a Novell network
  36. and returns this information to a batch process in the form of an
  37. error level or by writing the result to the DOS environment table
  38. as the NWHAT variable.
  39.   I wrote NWHAT because I got tired of writing custom menus for
  40. all of my users.   Seems like every workstation has a slightly
  41. different set up and requires a different configuration file for
  42. every application on the network.
  43.   NWHAT allows dynamic branching within a batch file or Novell menu
  44. based on the work station and user information it can supply.  It
  45. also allows me to edit LOGIN scripts with a text editor instead of
  46. going into SYSCON.  It also allows me to change printer configurations
  47. with PRINTCON without having to log in as the user. I use NWHAT to
  48. login Network Assistant printer servers onto the network when the
  49. user logs out.
  50.  
  51.  
  52. Usage:
  53.   NWHAT -command [argument]
  54.   
  55. Running NWHAT without a proper command will produce a help screen.
  56.  
  57.  
  58. Result Codes: (General)
  59.   NWHAT will return a error level or zero (0) if the command com-
  60. pleted successfully.
  61.  
  62.   Errors which keep the program from completing correctly return
  63. an error level of one (1).  These errors include:
  64.  
  65.   "Not attach to the Network"
  66.   "Out of Environment Space"
  67.   "Invalid Command"
  68.   "Invalid or Missing Argument"
  69.  
  70. These errors will also produce an accompanying error message.  
  71.  
  72. Commands which require simple yes or no result return error levels,
  73. all others commands output their results to the NWHAT variable in
  74. the DOS environment table.  If the variable does not exist it is
  75. created.  If it does exist it is overwritten with the results of
  76. this command.  The information written to the NWHAT variable can
  77. then be read by a batch file using the %NWHAT% syntax or viewed by
  78. entering a SET command at the DOS prompt.
  79.  
  80. NWHAT - Network What                            Page 3
  81. A batch file enhancement program for Novell Networks
  82. Version 1.3b
  83. Date  - 03/15/90
  84.  
  85. Commands:
  86.  
  87.   A command must be entered with a proceeding dash (-) or slash
  88. (/) character.  Only the first two characters of the command are
  89. required.  Improperly entered commands cause a help screen to be
  90. displayed.
  91.   
  92. Command    Purpose
  93.  
  94.  -name     Returns the user's LOGIN NAME.
  95.            Returns ERRORLEVEL 2 if you are not logged in to the network.
  96.                      
  97.  -full     Returns the user's full name as entered during the MAKEUSER
  98.            process.  Spaces are translated to underscore (_) characters
  99.            to be compatible with the operation of the SET command.
  100.            "UNKNOWN" is returned to the environment if no full name was
  101.            ever entered for the user.
  102.            If no argument is entered NWHAT returns the full name of the
  103.            user logged in at this workstation.  Otherwise NWHAT will the
  104.            return the full name of the user with that LOGIN NAME.
  105.            Return's ERRORLEVEL 3 if no user by that LOGIN NAME exists on
  106.            this server.
  107.            
  108.  -id       Returns the user's mail box ID.  This is the name of the sub
  109.            directory under \MAIL on the SYS volume where the user receives
  110.            their mail.  This is also where the user's LOGIN script and
  111.            PRINTCON configuration files are kept.
  112.            If no argument is entered NWHAT returns the mail ID of the
  113.            user logged in at this workstation.  Otherwise NWHAT will the
  114.            return the mail ID of the user with that LOGIN NAME.
  115.            Return's ERRORLEVEL 3 if no user by that LOGIN NAME exists on
  116.            this server.
  117.  
  118.  -station  Returns the logical station number that this work station is
  119.            attached to on the file server.
  120.            
  121.  -physical Returns the physical station number (usually the network
  122.            interface card number) of this work station.
  123.  
  124.  -display  Returns the video display type.  Will return VGA, EGA, CGA, MCGA,
  125.            MGA (Hercules) or MDA.  Defaults to CGA if card type is unknown.
  126.  
  127.  -logged   Returns ERRORLEVEL 0 if the work station is logged in to a
  128.            file server.  ERRORLEVEL 2 if the network shell has been
  129.            loaded but the work station is not logged in.
  130.            
  131.  -attach   Returns ERRORLEVEL 0 if the work station is attached to the file
  132.            server specified in the argument.  Returns ERRORLEVEL 2 if the
  133.            work station is not attached to the named file server.
  134.  
  135.  -fserver  Returns the name of the file server name mapped to the
  136.            default disk drive or to the drive specified in the
  137.            argument.  If the drive is not mapped to a file server
  138.            the primary file server name is returned.
  139.            If no argument is entered the current default drive is assumed.
  140.  
  141. NWHAT - Network What                                      Page 4
  142. A batch file enhancement program for Novell Networks
  143. Version 1.3b
  144. Date  - 03/15/90
  145.  
  146.  -volume   Returns the name of the disk volume on the file server
  147.            mapped to the default disk drive or to the drive
  148.            specified in the argument.
  149.            Returns ERRORLEVEL 2 if the drive is not mapped to a
  150.            file server volume.  If no argument is entered the
  151.            current default drive is assumed.
  152.  
  153.  -map      Returns the network map specification (including the
  154.            volume name) of the default disk drive or the drive
  155.            specified in the argument.
  156.            Returns "LOCAL" if the drive is mapped to a local DOS
  157.            drive.  Returns ERRORLEVEL 2 if the drive is not a local
  158.            drive and is not mapped to a file server.
  159.  
  160.  -netbios  Returns ERRORLEVEL 0 if NETBIOS is loaded.
  161.            Returns ERRORLEVEL 2 if NETBIOS is NOT loaded.
  162.            
  163.  -user     Used to tell if another user is logged into this file
  164.            server.  Returns ERRORLEVEL 0 if the Login ID is valid
  165.            and the user is presently logged in to the server.
  166.            Returns ERRORLEVEL 2 if the Login ID is valid for this
  167.            file server but the user is not logged in.
  168.            Returns ERRORLEVEL 3 if the Login ID is invalid for this
  169.            file server.
  170.  
  171.  -member   Returns ERRORLEVEL 0 if the logged user is a member of the
  172.            group specified in the argument.  Returns ERRORLEVEL 2 if
  173.            they are not a member of the named group.
  174.  
  175.            
  176. Additional Information:
  177.  
  178.   NWHAT writes the results to the "REAL" DOS environment table.
  179. NWHAT searches back through the running programs to find the root
  180. COMMAND.COM.  The search technique I'm using works fine on PC-DOS v3.3
  181. and Vectra DOS v3.3 but I have not tested it on other versions of MS
  182. DOS.  I adapted it from an assembly routine written by MicroSoft so it
  183. should be pretty reliable.  
  184.   This does mean that the results of NWHAT will NOT be written to the
  185. environment of a secondary COMMAND.COM!  This won't be a problem if you
  186. are running the secondary COMMAND.COM in the single command mode
  187. (the /c switch).  Most programs which allow you run a DOS command from
  188. within them (like the Dbase RUN command) use this mode. However programs
  189. like Lotus 123 which run a secondary COMMAND.COM will give you erroneous
  190. results.  The NWHAT results will not appear in the environment table of
  191. the secondary COMMAND.COM.
  192.   NWHAT only overwrites the results of a previous command if the current
  193. command completes successfully so you should always test for an error
  194. level of zero to make sure the NWHAT variable has been updated. This is
  195. particularly important when you are using commands with optional para-
  196. meters since these are most likely to fail from 'Invalid or Missing
  197. Parameter' errors.
  198. NWHAT - Network What                                      Page 5
  199. A batch file enhancement program for Novell Networks
  200. Version 1.3b
  201. Date  - 03/15/90
  202.  
  203. Example batch files:
  204.  
  205. Example 1:  This batch file demonstrates a controlled auto login process.
  206.   
  207.   REM NET.BAT
  208.   
  209.   echo off
  210.   cls
  211.   Rem See if the user is attached to the network.
  212.   NWHAT -logged
  213.   If ERRORLEVEL 2 Goto LOGIN
  214.   If ERRORLEVEL 1 Goto SHELL
  215.   NWHAT -fserver
  216.   echo This work station is attached to server %NWHAT%
  217.   NWHAT -station
  218.   echo as station %NWHAT%.
  219.   NWHAT -name
  220.   echo Login ID is %NWHAT%
  221.   Goto END
  222.   :SHELL
  223.   IPX
  224.   NET3
  225.   :LOGIN
  226.   LOGIN %1 %2
  227.   :END
  228.  
  229.  
  230. Example 2:  Sending and Receiving Files through mail directories
  231.  
  232.   This batch file transfers a file into a user's mail directory.
  233.   
  234.   Rem SENDMAIL.BAT
  235.   Rem Command line Usage
  236.   Rem SENDMAIL filename LoginID
  237.   echo off
  238.   cls
  239.   NWHAT -id %2
  240.   If ERRORLEVEL 2 GOTO NO_USER
  241.   If ERRORLEVEL 1 GOTO NO_NET
  242.   MAP M:=SYS:MAIL\%NWHAT%
  243.   COPY %1 M: /V
  244.   MAP DELETE M:
  245.   Echo Mail file %1 delivered to MAIL\%NWHAT%.
  246.   Goto END
  247.   :NO_USER
  248.   Echo %2 is not a valid User ID for this sever.
  249.   Goto END
  250.   :NO_NET
  251.   Echo You must be logged into the network to send mail.
  252.   :END
  253. NWHAT - Network What                   Page 6
  254. A batch file enhancement program for Novell Networks
  255. Version 1.3b
  256. Date  - 03/15/90
  257.  
  258.   Rem VIEWMAIL.BAT
  259.   Rem Get a directory list of the files in your Mail Box.
  260.   echo off
  261.   cls
  262.   NWHAT -id
  263.   If ERRORLEVEL 1 GOTO NO_NET
  264.   MAP M:=SYS:MAIL\%NWHAT%
  265.   DIR M: /P
  266.   Pause
  267.   MAP DELETE M:
  268.   GOTO END
  269.   :NO_NET
  270.   echo You must be logged into the network to view your Mail Box files.
  271.   :END
  272.   
  273.   
  274.   Rem GETMAIL.BAT
  275.   Rem Copy a file from your mail box to the current directory
  276.   Rem Usage:  GETMAIL filename
  277.   echo off
  278.   cls
  279.   NWHAT -id
  280.   If ERRORLEVEL 1 GOTO NO_NET
  281.   MAP M:=SYS:MAIL\%NWHAT%
  282.   IF NOT EXIST M:%1 GOTO NO_FILE
  283.   COPY M:%1 /V
  284.   MAP DELETE M:
  285.   GOTO END
  286.   :NO_NET
  287.   echo You must be logged into the network to view your Mail Box files.
  288.   Goto END
  289.   :NO_FILE
  290.   echo The file %1 is not in your Mail Box.
  291.   :END
  292.  
  293. Example 3:  Edit a login script file without going into SYSCON
  294.             This batch file uses the TED editor from PC Magnet
  295.             but would work with anything else.
  296.  
  297.   Rem EDLOGIN.BAT
  298.   Rem Allows SUPERVISOR (or User) to edit a LOGIN script
  299.   Rem Usage EDLOGIN LoginID
  300.   echo off
  301.   NWHAT -id %1
  302.   If ERRORLEVEL 2 GOTO NO_USER
  303.   If ERRORLEVEL 1 GOTO NO_NET
  304.   MAP M:=SYS:MAIL\%NWHAT%
  305.   If NOT EXIST M:LOGIN. GOTO NO_FILE
  306.   TED M:LOGIN.
  307.   MAP DELETE M:
  308.   Goto END
  309.   :NO_FILE
  310.   Echo There is no LOGIN script file to edit for this user.
  311.   Goto END
  312.   :NO_USER
  313.   
  314. NWHAT - Network What                                      Page 7
  315. A batch file enhancement program for Novell Networks
  316. Version 1.3b
  317. Date  - 03/15/90
  318.  
  319. EDLOGIN.BAT Continued
  320.  
  321.   Echo %2 is not a valid User ID for this sever.
  322.   Goto END
  323.   :NO_NET
  324.   Echo You must be logged into the network to edit a LOGIN script.
  325.   :END
  326.   
  327. Example 4: Saving and restoring a drive map
  328.   
  329.   
  330.   NWHAT -map  L:
  331.   If ERRORLEVEL 2 GOTO SET NWHAT=NONE
  332.   If ERRORLEVEL 1 GOTO END
  333.   Rem Sample of Program map and execution
  334.   MAP L:=SYS:APPLICS\WS50
  335.   L:
  336.   WP
  337.   IF %NWHAT%==NONE GOTO DEL_MAP
  338.   MAP L:=%NWHAT%
  339.   Goto END
  340.   :DEL_MAP
  341.   MAP DELETE %1
  342.   :END
  343.   
  344. Example 5: Keeping a NASSIST print server on line when user logs out
  345.  
  346.   Requires that a dummy user be set up.  I use PS for my print servers.
  347.   When the user logs out this batch file logs the print server in so
  348.   printing can continue normally.
  349.   
  350.   LOGOFF.BAT
  351.  
  352.   echo off
  353.   SET PS=NONE
  354.   NWHAT -physical
  355.   IF %NWHAT%==AA2700010100 SET PS=PS
  356.   IF %NWHAT%==346700010100 SET PS=PS
  357.   IF %NWHAT%==451000010100 SET PS=PS
  358.   IF %PS%==NONE LOGOUT
  359.   LOGIN PS
  360.  
  361. Example 6:  Edit a print configuration file without logging in
  362.             as the user.
  363.  
  364.   Rem PCON.BAT
  365.   Rem Allows SUPERVISOR or Group Manager to edit a user's printer
  366.   Rem configuration without logging in as the user.
  367.   Rem Usage PCON LoginID
  368.   echo off
  369.   NWHAT -id
  370.   If ERRORLEVEL 1 GOTO NO_NET
  371.   MAP H:=SYS:MAIL\%NWHAT%
  372.   H:
  373.   Copy PRINTCON.DAT PRINTCON.SAV
  374. NWHAT - Network What                                      Page 8
  375. A batch file enhancement program for Novell Networks
  376. Version 1.3b
  377. Date  - 03/15/90
  378.  
  379. PCON.BAT - Continued
  380.  
  381.   NWHAT -id %1
  382.   If ERRORLEVEL 2 GOTO NO_USER
  383.   If ERRORLEVEL 1 GOTO NO_NET
  384.   MAP M:=SYS:MAIL\%NWHAT%
  385.   If NOT EXIST M:PRINTCON.DAT GOTO NO_FILE
  386.   COPY M:PRINTCON.DAT
  387.   PRINTCON
  388.   COPY PRINTCON.DAT M:
  389.   Goto END
  390.   :NO_FILE
  391.   Echo There is no printer configuration file to edit for this user.
  392.   Goto END
  393.   :NO_USER
  394.   Echo %2 is not a valid User ID for this server.
  395.   Goto END1
  396.   :NO_NET
  397.   Echo You must be logged into the network to edit a LOGIN script.
  398.   Goto END2
  399.   :END
  400.   MAP DELETE M:
  401.   :END1
  402.   COPY PRINTCON.SAV PRINTCON.DAT
  403.   :END2
  404.   
  405. NWHAT - Network What                                      Page 9
  406. A batch file enhancement program for Novell Networks
  407. Version 1.3b
  408. Date  - 03/15/90
  409.  
  410.  
  411. License:
  412.  
  413.   You are free to use NWHAT for your own personal use.  You
  414. may copy and distribute NWHAT and the accompanying documentation
  415. provided no fee is charge for other than the copying of the
  416. media.  This includes posting NWHAT on Bulletin board systems
  417. and information services.
  418.   
  419.   You may NOT distribute NWHAT without the documentation and
  420. copyright notice.  You may NOT use NWHAT in a commercial
  421. application without paying the license fee.  You may NOT use
  422. NWHAT in a government application without paying the license
  423. fee except for the Federal government.  Federal government
  424. agencies may use NWHAT free of charge.
  425.  
  426.   You may obtain a license to use NWHAT on a single file server
  427. by mailing a check or money order for $20.00 (US) to:
  428.  
  429.       Precision Data Consultants
  430.       NE 1670 Old Belfair Hwy
  431.       Belfair, WA 98528
  432.       
  433.   If you would like the latest version of NWHAT enclose an
  434. additional $5.00 and we will mail you the most current version.
  435. Either way we will put you on our mailing list and keep you up
  436. to date on all our products.
  437.  
  438.  If you feel that $20.00 is too much to ask for the use of NWHAT
  439. please check the pricing for other network software.  If you still
  440. think $20.00 is unreasonable then please do not use NWHAT for
  441. other than personal purposes.
  442.  
  443.   We welcome your suggestions, questions and your bugs/ 
  444. abnormality reports,  give us a call at (206) 275-5597 or
  445. EasyPlex a message on Compuserve (73347,3225).
  446.  
  447.   I would like to express my special thanks to John McCann 
  448. Compuserve NOVUSER Sysop for helping me understand the packet
  449. structures for Novell calls and replies.
  450.  ting can continue normally.
  451.   
  452.   LOGOFto
  453.