@echo off

set EXE=..\software\adk-setup.exe
set OSCDPATH="%ProgramFiles(x86)%\Windows Kits\10\Assessment and Deployment Kit\Deployment Tools\amd64\Oscdimg"
set STARTMENU=%PROGRAMDATA%\"Microsoft\Windows\Start Menu\Programs"

if NOT EXIST %EXE% (
  echo ERROR: %EXE% not found!
  exit /b
)

echo ####### %0 #######

echo installing Microsoft ADK deployment tools ...
%EXE% /q /ceip off /norestart /features OptionId.DeploymentTools

if NOT EXIST %OSCDPATH%\oscdimg.exe (
  echo ERROR: cannot find oscdimg.exe!
  echo INFO: Installation of "Assessment and Deployment Kit (ADK)" failed!

  echo.
  echo ####### %0 #######
  exit /b
)

rem ADK ...
move /Y %STARTMENU%\"Windows Kits\Windows ADK\Windows System Image Manager.lnk" ^
  %STARTMENU%\"System Tools\Image Manager.lnk" 2>nul
rd /S /Q %STARTMENU%\"Windows Kits" 2>nul

rem show oscdimg usage:
%OSCDPATH%\oscdimg.exe

echo ####### %0 #######
pause

