@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
    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 END
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:%~dp01e9e49bab43d4ceeabb1d95c0a461857.appxbundle /DependencyPackagePath:%~dp0Microsoft.VCLibs.140.00.UWPDesktop_14.0.29231.0_x64__8wekyb3d8bbwe.appx /LicensePath:%~dp01e9e49bab43d4ceeabb1d95c0a461857_License1.xml /Region="ALL"

GOTO END

:END

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


