@echo OFF

REM Copyright (C) 1994-1995 Microsoft Corporation
REM
REM This batch file is the Systems Management Server (SMS) logon script
REM for OS/2 workstations logging in to a Windows NT or LAN Manager server.
REM It installs the SMS client components and collects hardware and
REM software inventory data.

echo.
echo Microsoft Systems Management Server (SMS)
echo.

REM If the SMSLS environment variable is set on the workstation (e.g.,
REM set SMSLS=1), verbose output will be enabled for SETLSOS2, CLI_OS2,
REM and INVDO2.

if "%SMSLS%" == "" goto START
set SMS_VERBOSE=/v
echo Executing logon script.
goto START

REM Determine the binary files directory on the SMS logon server by
REM checking environment variables for operating system and processor
REM architecture. Set environment variables for this directory and
REM for the OS type. The directory this file exists in and the platform
REM specific directory beneath it are added to the path so that the proper
REM version of SETLS and NLSMSG can be called.

:START
if "%OS%" == "Windows_NT" goto NT_CALL

REM check to see if we can save path and reserve the neccessary environment
REM space before continueing.
set SMS_P=%PATH%
set SMS_TEMP=123456789012345678901234567890123456789012345
if %SMS_TEMP%==123456789012345678901234567890123456789012345 goto FIND_OS
goto LOW_ENV

:FIND_OS
set SMS_TEMP=

:OS2
set SMS_OS=o2
set SMS_BIN=x86.bin
goto RUN_FROM

echo.
echo Unable to determine operating system or processor architecture.
echo.
echo Consult your network administrator.
echo.
pause
goto END


:NT_CALL
call runsms.bat
goto END

:RUN_FROM
set PATH=%0\..;%0\..\%SMS_BIN%;%PATH%

REM Check for a slow network connection to the NETLOGON share and
REM possibly exit.  If not, he SETLS program is run during NET LOGON to
REM a Windows NT or LAN Manager server and is used to find the correct
REM server and spawn the executable files for CLI_OS2 and
REM INVOS2 located on this server.

%0\..\netspeed
if not errorlevel 1 goto RUN_SETLS
if not errorlevel 2 goto RESTORE
if errorlevel 2 NLSMSG%SMS_OS% 6 /C YN /T Y,30 /M "Slow network detected. Continue"
if not errorlevel 2 goto RUN_SETLS
goto RESTORE

:RUN_SETLS

%0\..\x86.bin\setlsos2 -m:E -i -p:%SMS_BIN%\CLI_OS2.EXE -pa:/p:%%SMS_UNC%%\ -pa:%SMS_VERBOSE% %SMS_VERBOSE%
%0\..\x86.bin\setlsos2 -m:E -i -p:%SMS_BIN%\INVOS2.EXE  -pa:/l:%%SMS_UNC%%\ -pa:%SMS_VERBOSE% %SMS_VERBOSE%
goto RESTORE


REM RUNSMS was unable to reserve the neccessary amount of environment space
REM and was unable to complete successfully. Increase the available environment
REM space and retry this batch file.

:LOW_ENV
set SMS_TEMP=
echo.
%0\..\x86.bin\NLSMSGo2 7 /M "Not enough environment space"
%0\..\x86.bin\NLSMSGo2 8 /M "Use the /E parameter on the shell= command in config.sys"
%0\..\x86.bin\NLSMSGo2 9 /M "to increase the amount of environment space available."
pause
goto END


:RESTORE
REM restore the previous path setting.
PATH=%SMS_P%
goto END

REM Clean up the environment variables.
:END
set SMS_P=
set SMS_OS=

set SMS_BIN=
set SMS_VERBOSE=

