home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 8 Other / 08-Other.zip / lsmt213c.zip / getcmd.cmd < prev    next >
OS/2 REXX Batch file  |  2000-01-13  |  6KB  |  179 lines

  1. /*---------------------------------------------------------------------------*\
  2. |   GET DCDB information from the Domain Controller by Drag & Drop            |
  3. |                                                                             |
  4. |                                            (C) Alain Rykaert - MAY96-JAN00  |
  5. \*---------------------------------------------------------------------------*/
  6.     Version = '1.04'
  7.  
  8.     Parse Upper Arg Mute ServerName InputName
  9.  
  10.     Say '* GetCMD Version' Version
  11.     Say '* ServerName:' ServerName
  12.     Say '* InputName:' InputName
  13.  
  14.     Call Init                    /* Initialisation of DLL's and other stuff*/
  15.  
  16.     Call ChkFile Directory()'\popup.exe'   /* Check for Message Box program*/
  17.  
  18.     Select
  19.       When ServerName = ''
  20.         Then Do
  21.               'Start Popup "You must enter a ComputerName of a DC" "LSMT Message"'
  22.                Exit
  23.              End
  24.       When InputName = ''
  25.         Then Do
  26.               'Start Popup "Just Drag & Drop an Output file on me" "LSMT Message"'
  27.                Exit
  28.              End
  29.       Otherwise Nop
  30.     End
  31.  
  32.     If NetGetInfo(350, 'WkstaInfo','') <> 0 & WkstaInfo.UserName = ''
  33.       Then Do
  34.             'Start Popup "No UserName logged on" "LSMT Message"'
  35.              Exit
  36.            End
  37.       Else Say '> Admin logged on:' WkStaInfo.UserName
  38.  
  39.     RC = NetGetInfo(370, 'ServerModalInfo', '\\'ServerName)
  40.     If RC = 0
  41.       Then Do
  42.              ServerRole = ServerModalInfo.Role
  43.              Say '> Role:' ServerRole
  44.              If WordPos('Primary', ServerRole) > 0     /* check server role*/
  45.                Then Nop
  46.                Else Do
  47.                       Say '! Error: This is not a Primary Domain Controller' '07'x
  48.                      'Start popup "This is not a Primary Domain Controller" "LSMT Message"'
  49.                       Exit
  50.                     End
  51.            End
  52.       Else Do
  53.              Say '! Error:' RC '07'x
  54.             'Start popup "Error:' RC 'from Server' ServerName'" "LSMT Message"'
  55.              Call Quit
  56.            End
  57.  
  58.     Call Main                                          /* Do the main thing*/
  59.  
  60.     Call Quit                                         /* Quit the procedure*/
  61.  
  62.  MAIN:/* --------------------------------------------------------------------*/
  63.  
  64.     InputName = Translate(InputName)
  65.  
  66.  /* Determine the Filename.Extension */
  67.  
  68.     TempName = InputName
  69.  
  70.     x = LastPos('\', InputName) + 1
  71.     FileName = SubStr(InputName, x)
  72.  
  73.  /* Select & start the associated program */
  74.  
  75.     Select
  76.  
  77.      When FileName = 'SERVERS.CSV'
  78.        Then Do
  79.               Say '* Getting all Servers from' ServerName
  80.              'Call getsrvs /m /srv:'ServerName '/out:'InputName '/log:'CurDir'\lsmt.log'
  81.             End
  82.  
  83.      When FileName = 'USERS.CSV'
  84.        Then Do
  85.               Say '* Getting all Users from' ServerName
  86.              'Call getusers /m /srv:'ServerName '/out:'InputName '/log:'CurDir'\lsmt.log'
  87.             End
  88.  
  89.      When FileName = 'GROUPS1.CSV'
  90.        Then Do
  91.               Say '* Getting all Groups from' ServerName
  92.              'Call getgrps1 /m /srv:'ServerName '/out:'InputName '/log:'CurDir'\lsmt.log'
  93.             End
  94.  
  95.      When FileName = 'GROUPS2.CSV'
  96.        Then Do
  97.               Say '* Getting all Group & Members from' ServerName
  98.              'Call getgrps2 /m /srv:'ServerName '/out:'InputName '/log:'CurDir'\lsmt.log'
  99.            End
  100.  
  101.      When FileName = 'ALIAS.CSV'
  102.        Then Do
  103.               Say '* Getting all Aliases from' ServerName
  104.              'Call getalias /m /srv:'ServerName '/out:'InputName '/log:'CurDir'\lsmt.log'
  105.            End
  106.  
  107.      When FileName = 'ACL.CSV'
  108.        Then Do
  109.               Say '* Getting all Access Control Lists from' ServerName
  110.              'Call getacl /m /srv:'ServerName '/out:'InputName '/log:'CurDir'\lsmt.log'
  111.            End
  112.  
  113.      When FileName = 'ASSGN.CSV'
  114.        Then Do
  115.               Say '* Getting all Logon Assingments from' ServerName
  116.              'Call getassgn /m /srv:'ServerName '/out:'InputName '/log:'CurDir'\lsmt.log'
  117.            End
  118.  
  119.      When FileName = 'APPL.CSV'
  120.        Then Do
  121.               Say '* Getting all Applications from' ServerName
  122.              'Call getappl /m /srv:'ServerName '/out:'InputName '/log:'CurDir'\lsmt.log'
  123.            End
  124.  
  125.      When FileName = 'SELECTOR.CSV'
  126.        Then Do
  127.               Say '* Getting all Application Selectors Servers from' ServerName
  128.              'Call getsel /m /srv:'ServerName '/out:'InputName '/log:'CurDir'\lsmt.log'
  129.            End
  130.  
  131.      When FileName = 'USERS.PWD'
  132.        Then Do
  133.               Say '* Getting all User Passwords from' ServerName
  134.              'Call getpwd /m /srv:'ServerName '/out:'InputName '/log:'CurDir'\lsmt.log'
  135.            End
  136.  
  137.      Otherwise Say ' Nothing To Do'
  138.  
  139.     End
  140.  
  141.     Return
  142.  
  143.  INIT:/* --------------------------------------------------------------------*/
  144.  
  145.    '@echo off'
  146.  
  147.     CurDir = Directory()                 /* Determine the current directory*/
  148.  
  149.     If Stream('RGUTIL.CMD', 'C', 'Query Exists') = ''
  150.       Then 'cd..'
  151.       Else Nop
  152.  
  153.     Call RgUtil   '/M'                                    /* Rexx Utilities*/
  154.     Call RgLSRXUT '/M'                             /* Lan Server Rexx Utils*/
  155.  
  156.     Return
  157.  
  158.  CHKFILE:/* -----------------------------------------------------------------*/
  159.  
  160.     Parse Arg FileName
  161.  
  162.     If Stream(FileName, 'C', 'Query Exists') = ''
  163.       Then Do
  164.              Say '! Error: file' FileName 'not found' '07'x
  165.              Call Quit
  166.           End
  167.       Else Nop
  168.  
  169.     Return
  170.  
  171.  QUIT:/* --------------------------------------------------------------------*/
  172.  
  173.     Say
  174.     Say '* Done. Press the [Enter] key to leave'
  175.     Pull
  176.  
  177.     Exit
  178.  
  179.