home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 8 Other / 08-Other.zip / lsmt213c.zip / chkpwd.cmd < prev    next >
OS/2 REXX Batch file  |  1998-04-27  |  5KB  |  153 lines

  1. /*---------------------------------------------------------------------------*\
  2. |   Check Password replication                (C) Alain Rykaert - DEC97-APR98 |
  3. \*---------------------------------------------------------------------------*/
  4.          /* it's hard to say, but thanks to jacques from morgan euroclear */
  5.     Version = '1.01'
  6.     Say '* CHKPWD Version' Version
  7.  
  8.     Call Init                                 /* init dll's and other stuff*/
  9.     Call SysCls
  10.  
  11.     OutFile = 'CHKPWD.LOG'                               /* Output filename*/
  12.  
  13.     TempFile = LSRDrive'\ibmlan\chkpwd.txt'               /* temporary file*/
  14.     Say '* Temporary file:' TempFile
  15.  
  16. /*===================================*/
  17.     DCName = 'JD0F0101'
  18.     UserID = '$pol'
  19. /*===================================*/
  20.  
  21.     RC = NetGetInfo(340, 'Server', '\\'DCName, 'Servers')
  22.     If RC = 0
  23.       Then Do
  24.              Say '* Total Defined servers:' Server.0
  25.              Say '* Scanning active servers...'
  26.              Call SysCurState Off
  27.              Parse Value SysCurPos() With Row Col
  28.              j = 0
  29.              Do i = 1 to Server.0
  30.                Call SysCurPos Row, 0
  31.                Color = Random(41,46)
  32.                Say ' ' i
  33.                If Stream('\\'Server.i'\ibmlan$\ibmlan.ini', 'C','Query Exists') <> ''
  34.                  Then Do
  35.                         j = j + 1
  36.                         ServerName.j = Server.i
  37.                       End
  38.                  Else Nop
  39.              End
  40.            End
  41.       Else Call ChkError RC
  42.  
  43.     ServerName.0 = j
  44.  
  45.     Do i = 1 to ServerName.0                   /* Reset all status counters*/
  46.       Status.i = ''
  47.     End
  48.  
  49.     OutText = '* Total active servers:' ServerName.0
  50.     Say OutText
  51.     Call LineOut OutFile, OutText
  52.     Call Stream  OutFile, 'C', 'Close'
  53.  
  54.    'if not exist \\'DCName'\ibmlan$\netprog\pwdexp.exe copy pwdexp.exe \\'DCName'\ibmlan$\netprog\pwdexp.exe'
  55.    'net admin \\'DCName '/c pwdexp' UserID '>' TempFile
  56.     DCPassword = LineIn(TempFile)
  57.     Call Stream TempFile, 'C', 'Close'
  58.  
  59.     Call LineOut OutFile, Time() DCName
  60.     Call Stream  OutFile, 'C', 'Close'
  61.  
  62.     Say '* Total active servers:' ServerName.0
  63.  
  64.     LoopCounter = 0
  65.     Call Time('R')
  66.     Found = 0
  67.     Do While Found <> ServerName.0
  68.       LoopCounter = LoopCounter + 1
  69.       Say Left('*', 40, '-') 'Loop:' LoopCounter
  70.       Do i = 1 to ServerName.0
  71.         If Status.i <> 'OK'
  72.           Then Do
  73.                  Say '* ServerName:' i ServerName.i Status.i
  74.                 'if not exist \\'ServerName.i'\ibmlan$\netprog\pwdexp.exe copy pwdexp.exe \\'ServerName.i'\ibmlan$\netprog\pwdexp.exe'
  75.                 'net admin \\'ServerName.i '/c pwdexp' UserID '>' TempFile
  76.                  ServerPassword = LineIn(TempFile)
  77.                  Call Stream TempFile, 'C', 'Close'
  78.                  If DCPassword = ServerPassword
  79.                    Then Do
  80.                           Status.i = 'OK'
  81.                           Found = Found + 1
  82.                           Say '  Found:' Found
  83.                           Call Beep 2000,50
  84.                           Call LineOut OutFile, Time() ServerName.i
  85.                           Call Stream  OutFile, 'C', 'Close'
  86.                         End
  87.                    Else Nop
  88.                End
  89.           Else Nop
  90.       End
  91.     End
  92.     Say '* Total Time:' Trunc(Time('E'),2)
  93.  
  94.     Exit
  95.  
  96.  INIT:/* --------------------------------------------------------------------*/
  97.  
  98.    '@echo off'
  99.     BootDrive = Left(Value('Comspec',,'OS2Environment'),2)
  100.  
  101.     If RxFuncQuery('SysLoadFuncs')
  102.       Then Do
  103.              Call RxFuncAdd SysLoadFuncs, RexxUtil, SysLoadFuncs
  104.              Call SysLoadFuncs
  105.            End
  106.       Else Nop
  107.  
  108.     LSRDrive = ''                      /* Check for Lan Server Drive Letter*/
  109.     PPath = Translate(Value('DPATH',,'OS2Environment'))
  110.     x = Pos('\IBMLAN\NETPROG;', PPath) -2
  111.     If x > 0
  112.       Then Do
  113.              LSRDrive = SubStr(PPath, x, 2)
  114.              Say '* LanServer Drive:' LSRDrive
  115.            End
  116.       Else Do
  117.              Say '* Could not determine the Lan Requester path'
  118.              Exit
  119.            End
  120.  
  121.     Call ChkFile LSRDrive'\ibmlan\netlib\lsrxut.dll'
  122.     If RxFuncQuery('LoadLSRXUTFuncs')
  123.       Then Do
  124.              Call RxFuncAdd LoadLsRxutFuncs, LSRXUT, LoadLsRxutFuncs
  125.              Call LoadLsRxutFuncs
  126.            End
  127.       Else Nop
  128.  
  129.     Return
  130.  
  131.  CHKERROR:/* ----------------------------------------------------------------*/
  132.  
  133.     Parse Arg RCode
  134.  
  135.     Say '* Error:' RCode
  136.     Exit X2D('1600')
  137.  
  138.     Return
  139.  
  140.  CHKFILE:/* -----------------------------------------------------------------*/
  141.  
  142.     Parse Arg File_To_Check
  143.  
  144.     If Stream(File_To_Check, 'C', 'Query Exists') = ''
  145.       Then Do
  146.              Say '! File not found:' File_To_Check
  147.              Exit
  148.            End
  149.       Else Nop
  150.  
  151.     Return
  152.  
  153.