@echo off

:: BatchGotAdmin
:-------------------------------------
REM  --> Check for permissions
    IF "%PROCESSOR_ARCHITECTURE%" EQU "amd64" (
>nul 2>&1 "%SYSTEMROOT%\SysWOW64\cacls.exe" "%SYSTEMROOT%\SysWOW64\config\system"
) ELSE (
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
)

REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
    echo Requesting administrative privileges...
    goto UACPrompt
) else ( goto gotAdmin )

:UACPrompt
    echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
    set params = %*:"=""
    echo UAC.ShellExecute "cmd.exe", "/c ""%~s0"" %params%", "", "runas", 1 >> "%temp%\getadmin.vbs"

    "%temp%\getadmin.vbs"
    del "%temp%\getadmin.vbs"
    exit /B

:gotAdmin
    pushd "%CD%"
    CD /D "%~dp0"

echo.
echo ******************************************************************************
echo *******IMSS Installation [START]*******
echo ******************************************************************************
echo.

rem =============================Check for vPro=============================
("%~dp0MEInfoWin64.exe" -feat "Current sku type") ^| find /i "Corporate"
if "%errorlevel%" == "0" GOTO Vpro_Install
GOTO noVpro_Install
rem =============================Check for vPro=============================

:Vpro_Install
rem =======================MESW drivers and Components(vPro)======================
echo.
echo.
echo System is vPro...
echo Installing IMSS app...
echo.

DISM /Online /Add-ProvisionedAppxPackage /PackagePath:%~dp0aa352619b19446e4a9999a9c8e0a1511.appxbundle /DependencyPackagePath:%~dp0Microsoft.VCLibs.140.00.UWPDesktop_14.0.30704.0_x64__8wekyb3d8bbwe.appx /LicensePath:%~dp0aa352619b19446e4a9999a9c8e0a1511_License1.xml /Region="ALL"

GOTO END

:noVpro_Install
if "%errorlevel%" == "1" set %errorlevel% = 0

GOTO END


:END

echo.
echo ******************************************************************************
echo ********IMSS Installation [END]********
echo ******************************************************************************
echo.


