@echo OFF

REM Copyright (C) 1994-1995 Microsoft Corporation
REM
REM This batch file is the Systems Management Server (SMS) script
REM for OS/2 workstations attaching to a Windows NT or LAN Manager server.
REM It installs the SMS client components and collects hardware and
REM software inventory data.

REM This batch file is run directly from a Windows NT, LAN
REM Manager, or NetWare SMS logon server for DOS, Windows, and Windows
REM NT workstations. To run directly from an SMS logon server, the user
REM must make a network connection (drive mapping) using an available
REM drive letter and then change the current drive to this network
REM drive. This connection must be to SMS_SHR for a Windows NT or LAN
REM Manager server, or to the SMS-volume:SMS-directory\LOGON.SRV
REM directory for a NetWare server.  This batch file can also be run
REM with a UNC such as \\SMS-server\\SMS_SHR\RUNSMS.

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 SMS_SHR 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 The SETLS program will spawn the executable files for CLI_OS2 and
REM INVOS2 located on this server.

:RUN_SETLS

setlsos2 -m:E -i -p:%SMS_BIN%\CLI_OS2.EXE -pa:/p:%%SMS_UNC%%\ -pa:%SMS_VERBOSE% %SMS_VERBOSE%
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=
