@ECHO OFF
REM GRNTC.BAT - delayed user-context GRANT readback helper.
REM Started by GRNTSTA via DLYSTRT. Runs from C:\GRNTTMP.

C:
CD \GRNTTMP

ECHO GRNTC user-context GRANT readback helper > HELPER.TXT
ECHO Current phase: logout supervisor, login NOPASSUSER. >> HELPER.TXT

LOGOUT > ULOG1.OUT
LOGIN NOPASSUSER > ULOGIN.OUT

F:
CD \
IF EXIST \NPUBLIC\RIGHTS.EXE GOTO HAVEF
ECHO F: not ready after NOPASSUSER login. >> C:\GRNTTMP\HELPER.TXT
GOTO RELSUP

:HAVEF
ECHO Starting G10_R as NOPASSUSER... >> C:\GRNTTMP\HELPER.TXT
\NPUBLIC\RIGHTS F:\GRNTEST\G10 > C:\GRNTTMP\UNOV\G10_R.OUT
\PUBLIC\RIGHTS F:\GRNTEST\G10 > C:\GRNTTMP\UPUB\G10_R.OUT
ECHO Starting G11_W as NOPASSUSER... >> C:\GRNTTMP\HELPER.TXT
\NPUBLIC\RIGHTS F:\GRNTEST\G11 > C:\GRNTTMP\UNOV\G11_W.OUT
\PUBLIC\RIGHTS F:\GRNTEST\G11 > C:\GRNTTMP\UPUB\G11_W.OUT
ECHO Starting G12_C as NOPASSUSER... >> C:\GRNTTMP\HELPER.TXT
\NPUBLIC\RIGHTS F:\GRNTEST\G12 > C:\GRNTTMP\UNOV\G12_C.OUT
\PUBLIC\RIGHTS F:\GRNTEST\G12 > C:\GRNTTMP\UPUB\G12_C.OUT
ECHO Starting G13_E as NOPASSUSER... >> C:\GRNTTMP\HELPER.TXT
\NPUBLIC\RIGHTS F:\GRNTEST\G13 > C:\GRNTTMP\UNOV\G13_E.OUT
\PUBLIC\RIGHTS F:\GRNTEST\G13 > C:\GRNTTMP\UPUB\G13_E.OUT
ECHO Starting G14_M as NOPASSUSER... >> C:\GRNTTMP\HELPER.TXT
\NPUBLIC\RIGHTS F:\GRNTEST\G14 > C:\GRNTTMP\UNOV\G14_M.OUT
\PUBLIC\RIGHTS F:\GRNTEST\G14 > C:\GRNTTMP\UPUB\G14_M.OUT
ECHO Starting G15_F as NOPASSUSER... >> C:\GRNTTMP\HELPER.TXT
\NPUBLIC\RIGHTS F:\GRNTEST\G15 > C:\GRNTTMP\UNOV\G15_F.OUT
\PUBLIC\RIGHTS F:\GRNTEST\G15 > C:\GRNTTMP\UPUB\G15_F.OUT
ECHO Starting G16_A as NOPASSUSER... >> C:\GRNTTMP\HELPER.TXT
\NPUBLIC\RIGHTS F:\GRNTEST\G16 > C:\GRNTTMP\UNOV\G16_A.OUT
\PUBLIC\RIGHTS F:\GRNTEST\G16 > C:\GRNTTMP\UPUB\G16_A.OUT
ECHO Starting G17_S as NOPASSUSER... >> C:\GRNTTMP\HELPER.TXT
\NPUBLIC\RIGHTS F:\GRNTEST\G17 > C:\GRNTTMP\UNOV\G17_S.OUT
\PUBLIC\RIGHTS F:\GRNTEST\G17 > C:\GRNTTMP\UPUB\G17_S.OUT
ECHO Starting G20_RF as NOPASSUSER... >> C:\GRNTTMP\HELPER.TXT
\NPUBLIC\RIGHTS F:\GRNTEST\G20 > C:\GRNTTMP\UNOV\G20_RF.OUT
\PUBLIC\RIGHTS F:\GRNTEST\G20 > C:\GRNTTMP\UPUB\G20_RF.OUT
ECHO Starting G21_RW as NOPASSUSER... >> C:\GRNTTMP\HELPER.TXT
\NPUBLIC\RIGHTS F:\GRNTEST\G21 > C:\GRNTTMP\UNOV\G21_RW.OUT
\PUBLIC\RIGHTS F:\GRNTEST\G21 > C:\GRNTTMP\UPUB\G21_RW.OUT
ECHO Starting G22_RWC as NOPASSUSER... >> C:\GRNTTMP\HELPER.TXT
\NPUBLIC\RIGHTS F:\GRNTEST\G22 > C:\GRNTTMP\UNOV\G22_RWC.OUT
\PUBLIC\RIGHTS F:\GRNTEST\G22 > C:\GRNTTMP\UPUB\G22_RWC.OUT
ECHO Starting G23_RWCE as NOPASSUSER... >> C:\GRNTTMP\HELPER.TXT
\NPUBLIC\RIGHTS F:\GRNTEST\G23 > C:\GRNTTMP\UNOV\G23_RWCE.OUT
\PUBLIC\RIGHTS F:\GRNTEST\G23 > C:\GRNTTMP\UPUB\G23_RWCE.OUT
ECHO Starting G24_RAL as NOPASSUSER... >> C:\GRNTTMP\HELPER.TXT
\NPUBLIC\RIGHTS F:\GRNTEST\G24 > C:\GRNTTMP\UNOV\G24_RAL.OUT
\PUBLIC\RIGHTS F:\GRNTEST\G24 > C:\GRNTTMP\UPUB\G24_RAL.OUT
ECHO Starting G25_SAL as NOPASSUSER... >> C:\GRNTTMP\HELPER.TXT
\NPUBLIC\RIGHTS F:\GRNTEST\G25 > C:\GRNTTMP\UNOV\G25_SAL.OUT
\PUBLIC\RIGHTS F:\GRNTEST\G25 > C:\GRNTTMP\UPUB\G25_SAL.OUT
ECHO Starting G26_ALL as NOPASSUSER... >> C:\GRNTTMP\HELPER.TXT
\NPUBLIC\RIGHTS F:\GRNTEST\G26 > C:\GRNTTMP\UNOV\G26_ALL.OUT
\PUBLIC\RIGHTS F:\GRNTEST\G26 > C:\GRNTTMP\UPUB\G26_ALL.OUT
ECHO Starting G27_N as NOPASSUSER... >> C:\GRNTTMP\HELPER.TXT
\NPUBLIC\RIGHTS F:\GRNTEST\G27 > C:\GRNTTMP\UNOV\G27_N.OUT
\PUBLIC\RIGHTS F:\GRNTEST\G27 > C:\GRNTTMP\UPUB\G27_N.OUT
ECHO Starting G30_RE as NOPASSUSER... >> C:\GRNTTMP\HELPER.TXT
\NPUBLIC\RIGHTS F:\GRNTEST\G30 > C:\GRNTTMP\UNOV\G30_RE.OUT
\PUBLIC\RIGHTS F:\GRNTEST\G30 > C:\GRNTTMP\UPUB\G30_RE.OUT
ECHO Starting G31_RWF as NOPASSUSER... >> C:\GRNTTMP\HELPER.TXT
\NPUBLIC\RIGHTS F:\GRNTEST\G31 > C:\GRNTTMP\UNOV\G31_RWF.OUT
\PUBLIC\RIGHTS F:\GRNTEST\G31 > C:\GRNTTMP\UPUB\G31_RWF.OUT
ECHO Starting G32_RCM as NOPASSUSER... >> C:\GRNTTMP\HELPER.TXT
\NPUBLIC\RIGHTS F:\GRNTEST\G32 > C:\GRNTTMP\UNOV\G32_RCM.OUT
\PUBLIC\RIGHTS F:\GRNTEST\G32 > C:\GRNTTMP\UPUB\G32_RCM.OUT
ECHO Starting G33_RFA as NOPASSUSER... >> C:\GRNTTMP\HELPER.TXT
\NPUBLIC\RIGHTS F:\GRNTEST\G33 > C:\GRNTTMP\UNOV\G33_RFA.OUT
\PUBLIC\RIGHTS F:\GRNTEST\G33 > C:\GRNTTMP\UPUB\G33_RFA.OUT
ECHO Starting G34_WCM as NOPASSUSER... >> C:\GRNTTMP\HELPER.TXT
\NPUBLIC\RIGHTS F:\GRNTEST\G34 > C:\GRNTTMP\UNOV\G34_WCM.OUT
\PUBLIC\RIGHTS F:\GRNTEST\G34 > C:\GRNTTMP\UPUB\G34_WCM.OUT
ECHO Starting G35_EMF as NOPASSUSER... >> C:\GRNTTMP\HELPER.TXT
\NPUBLIC\RIGHTS F:\GRNTEST\G35 > C:\GRNTTMP\UNOV\G35_EMF.OUT
\PUBLIC\RIGHTS F:\GRNTEST\G35 > C:\GRNTTMP\UPUB\G35_EMF.OUT
ECHO Starting G36_RMF as NOPASSUSER... >> C:\GRNTTMP\HELPER.TXT
\NPUBLIC\RIGHTS F:\GRNTEST\G36 > C:\GRNTTMP\UNOV\G36_RMF.OUT
\PUBLIC\RIGHTS F:\GRNTEST\G36 > C:\GRNTTMP\UPUB\G36_RMF.OUT
ECHO Starting G37_REMA as NOPASSUSER... >> C:\GRNTTMP\HELPER.TXT
\NPUBLIC\RIGHTS F:\GRNTEST\G37 > C:\GRNTTMP\UNOV\G37_REMA.OUT
\PUBLIC\RIGHTS F:\GRNTEST\G37 > C:\GRNTTMP\UPUB\G37_REMA.OUT
ECHO Starting G38_SR as NOPASSUSER... >> C:\GRNTTMP\HELPER.TXT
\NPUBLIC\RIGHTS F:\GRNTEST\G38 > C:\GRNTTMP\UNOV\G38_SR.OUT
\PUBLIC\RIGHTS F:\GRNTEST\G38 > C:\GRNTTMP\UPUB\G38_SR.OUT
ECHO Starting G39_SRF as NOPASSUSER... >> C:\GRNTTMP\HELPER.TXT
\NPUBLIC\RIGHTS F:\GRNTEST\G39 > C:\GRNTTMP\UNOV\G39_SRF.OUT
\PUBLIC\RIGHTS F:\GRNTEST\G39 > C:\GRNTTMP\UPUB\G39_SRF.OUT
ECHO Starting G40_SWCM as NOPASSUSER... >> C:\GRNTTMP\HELPER.TXT
\NPUBLIC\RIGHTS F:\GRNTEST\G40 > C:\GRNTTMP\UNOV\G40_SWCM.OUT
\PUBLIC\RIGHTS F:\GRNTEST\G40 > C:\GRNTTMP\UPUB\G40_SWCM.OUT
ECHO Starting F10_R as NOPASSUSER... >> C:\GRNTTMP\HELPER.TXT
\NPUBLIC\RIGHTS F:\GRNTEST\F10\T.TXT > C:\GRNTTMP\UNOV\F10_R.OUT
\PUBLIC\RIGHTS F:\GRNTEST\F10\T.TXT > C:\GRNTTMP\UPUB\F10_R.OUT
ECHO Starting F11_RF as NOPASSUSER... >> C:\GRNTTMP\HELPER.TXT
\NPUBLIC\RIGHTS F:\GRNTEST\F11\T.TXT > C:\GRNTTMP\UNOV\F11_RF.OUT
\PUBLIC\RIGHTS F:\GRNTEST\F11\T.TXT > C:\GRNTTMP\UPUB\F11_RF.OUT
ECHO Starting F12_RAL as NOPASSUSER... >> C:\GRNTTMP\HELPER.TXT
\NPUBLIC\RIGHTS F:\GRNTEST\F12\T.TXT > C:\GRNTTMP\UNOV\F12_RAL.OUT
\PUBLIC\RIGHTS F:\GRNTEST\F12\T.TXT > C:\GRNTTMP\UPUB\F12_RAL.OUT
ECHO Starting F13_ALL as NOPASSUSER... >> C:\GRNTTMP\HELPER.TXT
\NPUBLIC\RIGHTS F:\GRNTEST\F13\T.TXT > C:\GRNTTMP\UNOV\F13_ALL.OUT
\PUBLIC\RIGHTS F:\GRNTEST\F13\T.TXT > C:\GRNTTMP\UPUB\F13_ALL.OUT
ECHO Starting F14_N as NOPASSUSER... >> C:\GRNTTMP\HELPER.TXT
\NPUBLIC\RIGHTS F:\GRNTEST\F14\T.TXT > C:\GRNTTMP\UNOV\F14_N.OUT
\PUBLIC\RIGHTS F:\GRNTEST\F14\T.TXT > C:\GRNTTMP\UPUB\F14_N.OUT
ECHO Starting F15_S as NOPASSUSER... >> C:\GRNTTMP\HELPER.TXT
\NPUBLIC\RIGHTS F:\GRNTEST\F15\T.TXT > C:\GRNTTMP\UNOV\F15_S.OUT
\PUBLIC\RIGHTS F:\GRNTEST\F15\T.TXT > C:\GRNTTMP\UPUB\F15_S.OUT
ECHO Starting F16_SAL as NOPASSUSER... >> C:\GRNTTMP\HELPER.TXT
\NPUBLIC\RIGHTS F:\GRNTEST\F16\T.TXT > C:\GRNTTMP\UNOV\F16_SAL.OUT
\PUBLIC\RIGHTS F:\GRNTEST\F16\T.TXT > C:\GRNTTMP\UPUB\F16_SAL.OUT
ECHO Starting S10_R as NOPASSUSER... >> C:\GRNTTMP\HELPER.TXT
\NPUBLIC\RIGHTS F:\GRNTEST\S10\S1 > C:\GRNTTMP\UNOV\S10_R.OUT
\PUBLIC\RIGHTS F:\GRNTEST\S10\S1 > C:\GRNTTMP\UPUB\S10_R.OUT
ECHO Starting S11_RWC as NOPASSUSER... >> C:\GRNTTMP\HELPER.TXT
\NPUBLIC\RIGHTS F:\GRNTEST\S11\S1 > C:\GRNTTMP\UNOV\S11_RWC.OUT
\PUBLIC\RIGHTS F:\GRNTEST\S11\S1 > C:\GRNTTMP\UPUB\S11_RWC.OUT
ECHO Starting S12_ALL as NOPASSUSER... >> C:\GRNTTMP\HELPER.TXT
\NPUBLIC\RIGHTS F:\GRNTEST\S12\S1 > C:\GRNTTMP\UNOV\S12_ALL.OUT
\PUBLIC\RIGHTS F:\GRNTEST\S12\S1 > C:\GRNTTMP\UPUB\S12_ALL.OUT

:RELSUP
C:
CD \GRNTTMP
LOGOUT > ULOG2.OUT

F:
CD \
IF EXIST \LOGIN\LOGIN.EXE GOTO HAVELOG
ECHO F:\LOGIN\LOGIN.EXE not found. >> C:\GRNTTMP\HELPER.TXT
GOTO MANUAL

:HAVELOG
F:\LOGIN\LOGIN SUPERVISOR /PWD:%LGNTPWD% > C:\GRNTTMP\ULGSUP.OUT

F:
CD \
IF EXIST \GRNTSTA.BAT GOTO QUEUEP2
ECHO F: not restored or \GRNTSTA.BAT missing. >> C:\GRNTTMP\HELPER.TXT
GOTO MANUAL

:QUEUEP2
C:
CD \GRNTTMP
DLYSTRT /T:2 F:\GRNTSTA.BAT PART2
GOTO END

:MANUAL
ECHO Please run manually after SUPERVISOR login: >> C:\GRNTTMP\HELPER.TXT
ECHO   F: >> C:\GRNTTMP\HELPER.TXT
ECHO   CD \ >> C:\GRNTTMP\HELPER.TXT
ECHO   GRNTSTA PART2 >> C:\GRNTTMP\HELPER.TXT

:END
