home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 8 Other / 08-Other.zip / lsmt213c.zip / setcmd.cmd < prev    next >
OS/2 REXX Batch file  |  1998-08-17  |  7KB  |  221 lines

  1. /*---------------------------------------------------------------------------*\
  2. |   SET all or some changes back to the Domain Controller by Drag & Drop      |
  3. |                                                                             |
  4. |                                               (C) Alain Rykaert MAY96-AUG98 |
  5. \*---------------------------------------------------------------------------*/
  6.     Version = '1.03'
  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.     RC = NetGetInfo(370, 'ServerModalInfo', '\\'ServerName)
  33.     If RC = 0
  34.       Then Do
  35.              ServerRole = ServerModalInfo.Role
  36.              Say '* Role:' ServerRole
  37.              If WordPos('Primary', ServerRole) > 0     /* check server role*/
  38.                Then Do
  39.                       Call SysFileSearch 'DOMAIN =', '\\'ServerName'\ibmlan$\ibmlan.ini', 'FILE.'
  40.                       If File.0 > 0
  41.                         Then Do j = 1 to File.0
  42.                                Parse Value File.j with Begin '=' Rest .
  43.                                If Left(Begin,1) = ';'
  44.                                  Then Nop
  45.                                  Else DomainName = Rest
  46.                              End
  47.                         Else Do
  48.                                Say '! Error: Unable to determine the Domains name'
  49.                                Say'          from the Primary Domain Controller' ServerName
  50.                               'Start popup "Could not find the domain name" "LSMT Message"'
  51.                                Call Quit
  52.                              End
  53.                     End
  54.                Else Do
  55.                       Say '! This is not a Primary Domain Controller' '07'x
  56.                      'Start popup "This is not a Primary Domain Controller" "LSMT Message"'
  57.                       Call Quit
  58.                     End
  59.            End
  60.       Else Do
  61.              Say '! Error:' RC '07'x
  62.             'Start popup "Error:' RC 'from Server' ServerName'" "LSMT Message"'
  63.              Call Quit
  64.            End
  65.  
  66.     Call Main                                          /* Do the main thing*/
  67.  
  68.     Call Quit                                         /* Quit the procedure*/
  69.  
  70.  MAIN:/* --------------------------------------------------------------------*/
  71.  
  72.     InputName = Translate(InputName)
  73.  
  74.  /* Determine the Filename.Extension */
  75.  
  76.     TempName = InputName
  77.  
  78.     x = LastPos('\', InputName) + 1
  79.     FileName = SubStr(InputName, x)
  80.  
  81.  /* Select & start the associated program */
  82.  
  83.     Select
  84.  
  85.      When FileName = 'SERVERS.CSV'
  86.        Then Do
  87.               Say '* Setting all Servers to' ServerName
  88.              'Call SetSrvs /m /srv:'ServerName '/inp:'InputName '/log:'CurDir'\lsmt.log'
  89.             End
  90.  
  91.      When FileName = 'USERS.CSV'
  92.        Then Do
  93.               Say '* Setting all Users to' ServerName
  94.              'Call SetUsers /m /srv:'ServerName '/inp:'InputName '/log:'CurDir'\lsmt.log /HOM:'CurDir'\HomeACL.CSV'
  95.               Call MakeShadow CurDir'\HOMEACL.CSV' '<LSMT_DCDB_'DomainName'>'
  96.             End
  97.  
  98.      When FileName = 'GROUPS1.CSV'
  99.        Then Do
  100.               Say '* Setting all Groups to' ServerName
  101.              'Call SetGrps1 /m /srv:'ServerName '/inp:'InputName '/log:'CurDir'\lsmt.log'
  102.             End
  103.  
  104.      When FileName = 'GROUPS2.CSV'
  105.        Then Do
  106.               Say '* Setting all Groups & Memebers to' ServerName
  107.              'Call SetGrps2 /m /srv:'ServerName '/inp:'InputName '/log:'CurDir'\lsmt.log'
  108.             End
  109.  
  110.      When FileName = 'ALIAS.CSV'
  111.        Then Do
  112.               Say '* Setting all Aliases to' ServerName
  113.              'Call SetAlias /m /srv:'ServerName '/inp:'InputName '/log:'CurDir'\lsmt.log'
  114.             End
  115.  
  116.      When FileName = 'ACL.CSV'
  117.        Then Do
  118.               Say '* Setting all Access Control List to' ServerName
  119.              'Call SetAcl /m /srv:'ServerName '/inp:'InputName '/log:'CurDir'\lsmt.log'
  120.             End
  121.  
  122.      When FileName = 'ASSGN.CSV'
  123.        Then Do
  124.               Say '* Setting all Logon Assignments to' ServerName
  125.              'Call SetAssgn /m /srv:'ServerName '/inp:'InputName '/log:'CurDir'\lsmt.log'
  126.             End
  127.  
  128.      When FileName = 'APPL.CSV'
  129.        Then Do
  130.               Say '* Setting all Applications to' ServerName
  131.              'Call SetAppl /m /srv:'ServerName '/inp:'InputName '/log:'CurDir'\lsmt.log'
  132.             End
  133.  
  134.      When FileName = 'SELECTOR.CSV'
  135.        Then Do
  136.               Say '* Setting all Application Selectors to' ServerName
  137.              'Call SetSel /m /srv:'ServerName '/inp:'InputName '/log:'CurDir'\lsmt.log'
  138.             End
  139.  
  140.      When FileName = 'USERS.PWD'
  141.        Then Do
  142.               Say '* Setting all Users Passwords to' ServerName
  143.              'Call SetPwd /m /srv:'ServerName '/inp:'InputName '/log:'CurDir'\lsmt.log'
  144.             End
  145.  
  146.      When FileName = 'HOMEACL.CSV'
  147.        Then Do
  148.               Say '* Setting all needed ACP'
  149.              'Call SetHome /m /srv:'ServerName '/inp:'InputName '/log:'CurDir'\lsmt.log'
  150.             End
  151.  
  152.      Otherwise Say '* Nothing To Do'
  153.  
  154.     End
  155.  
  156.     Return
  157.  
  158.  INIT:/* --------------------------------------------------------------------*/
  159.  
  160.    '@echo off'
  161.  
  162.     CurDir = Directory()                 /* Determine the current directory*/
  163.  
  164.     If Stream('RGUTIL.CMD', 'C', 'Query Exists') = ''
  165.       Then 'cd..'
  166.       Else Nop
  167.  
  168.     Call RgUtil   '/M'                                    /* Rexx Utilities*/
  169.     Call RgLSRXUT '/M'                             /* Lan Server Rexx Utils*/
  170.  
  171.     Return
  172.  
  173.  CHKFILE:/* -----------------------------------------------------------------*/
  174.  
  175.     Parse Arg FileName
  176.  
  177.     If Stream(FileName, 'C', 'Query Exist') = 0
  178.       Then Do
  179.              Say ' File' FileName 'not found.'
  180.              Exit
  181.            End
  182.       Else Nop
  183.  
  184.     Return
  185.  
  186.  MAKESHADOW:/* --------------------------------------------------------------*/
  187.  
  188.     Parse Arg InputFile Location
  189.  
  190.     RC = Stream(InputFile, 'C', 'Query Exists')
  191.     If RC = ''
  192.       Then Nop
  193.       Else Do
  194.              Class    = 'WPSHADOW'
  195.              Title    = 'HOMEACL.CSV'
  196.              Location =  Location
  197.              Setup    = 'SHADOWID='InputFile
  198.              Update   = 'Update'
  199.              Call CreateOBJ
  200.            End
  201.  
  202.     Return
  203.  
  204.  CREATEOBJ:/* ---------------------------------------------------------------*/
  205.  
  206.     If SysCreateObject(Class, Title, Location, Setup, Update) = 1
  207.       Then Nop
  208.       Else Say '! Error: while making a shadow' RC Title '07'x
  209.  
  210.     Return
  211.  
  212.  QUIT:/* --------------------------------------------------------------------*/
  213.  
  214.     Say
  215.     Say '* Done. Press the [Enter] key to leave'
  216.  
  217.     Pull
  218.  
  219.     Exit
  220.  
  221.