/*****************************************************************************/
/* RESYNC.CMD  --  LAN Server Resynchronization Procedure                    */
/*                                                                           */
/* Command to resync the NET Accounts Database on Server with Domain         */
/*                                                                           */
/*                                                                           */
/*****************************************************************************/
arg  help type .
TRACE  off

if help = '?' then signal HELP_INFO

/**************************************************************************/
/* USE OS2 ENVIRONMENT VARIABLE COMSPEC= TO FIND OS/2 BOOT DRIVE.         */
/**************************************************************************/
cmspec = value('COMSPEC',,'OS2ENVIRONMENT');
os2drv = left(cmspec,1)||':'

CALL RxFuncAdd 'SysSleep', 'RexxUtil', 'SysSleep'
CALL RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
CALL RxFuncAdd 'SysFileSearch','RexxUtil','SysFileSearch'
CALL SysLoadFuncs

/***************** determine NETBIOS name **local system*************/
CALL SysFileSearch 'Computername',os2drv'\ibmlan\ibmlan.ini','file.'
server = strip(subword(file.1,3,1))

'call logoff /y'

'call logon userid /p=password /vl'

net stop netlogon

'NET USER 'server' ""'

"NET accounts /role:standalone"

'NET USER 'server' ""'

"net accounts /role:member"

"net start netlogon"

exit

/************ help menu ********************************************/
HELP_INFO:
'cls'
say ' '
say ' '
say 'This command re-sync the NET ACCOUNTS DataBase on the Server S01 '
say 'with the Domain Controller D01                                   '
say ' '
say 'No parameters required'
say ' '
exit
