home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 24 DOS / 24-DOS.zip / nwhat4.exe / NWHAT4.DOC < prev   
Text File  |  1990-09-17  |  17KB  |  478 lines

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