@echo off
for /r X:\drivers %%i in (*.inf) do drvload %%i
wpeinit
for /f "usebackq tokens=2 delims==" %%m in (`wmic nic where "NetConnectionStatus=2" get MACAddress /value ^| find "MACAddress="`) do set "MAC=%%m"
set "MAC=%MAC:~0,17%"
X:\Windows\System32\curl.exe -s -o X:\autounattend.xml "http://192.168.239.242/winpe.xml?mac=%MAC%"
X:\Windows\System32\curl.exe -s -o X:\SetupComplete.cmd "http://192.168.239.242/winpe.cmd?mac=%MAC%"
X:\Windows\System32\curl.exe -s -o X:\dp.txt "http://192.168.239.242/winpe.dp?mac=%MAC%"
diskpart /s X:\dp.txt
X:\Windows\System32\curl.exe -o W:\install.wim "http://192.168.239.242/wim/win2008r2-en.wim"
dism /apply-image /imagefile:W:\install.wim /index:3 /applydir:W:\
del /f /q W:\install.wim
md W:\drv
X:\Windows\System32\curl.exe -s -o W:\drv\percsas2.inf "http://192.168.239.242/raiddrv/2008r2/percsas2.inf"
X:\Windows\System32\curl.exe -s -o W:\drv\percsas2.sys "http://192.168.239.242/raiddrv/2008r2/percsas2.sys"
X:\Windows\System32\curl.exe -s -o W:\drv\percsas2.cat "http://192.168.239.242/raiddrv/2008r2/percsas2.cat"
X:\Windows\System32\curl.exe -s -o W:\drv\b57nd60a.inf "http://192.168.239.242/nicdrv/2008r2/b57nd60a.inf"
X:\Windows\System32\curl.exe -s -o W:\drv\b57nd60a.sys "http://192.168.239.242/nicdrv/2008r2/b57nd60a.sys"
X:\Windows\System32\curl.exe -s -o W:\drv\b57nd60a.cat "http://192.168.239.242/nicdrv/2008r2/b57nd60a.cat"
dism /image:W:\ /add-driver /driver:W:\drv /recurse /forceunsigned
copy /y W:\drv\percsas2.sys W:\Windows\System32\drivers\percsas2.sys
reg load HKLM\BM W:\Windows\System32\config\SYSTEM
reg add "HKLM\BM\ControlSet001\Services\percsas2" /v Type /t REG_DWORD /d 1 /f
reg add "HKLM\BM\ControlSet001\Services\percsas2" /v Start /t REG_DWORD /d 0 /f
reg add "HKLM\BM\ControlSet001\Services\percsas2" /v ErrorControl /t REG_DWORD /d 1 /f
reg add "HKLM\BM\ControlSet001\Services\percsas2" /v ImagePath /t REG_EXPAND_SZ /d "System32\drivers\percsas2.sys" /f
reg add "HKLM\BM\ControlSet001\Services\percsas2" /v Group /t REG_SZ /d "SCSI Miniport" /f
reg add "HKLM\BM\ControlSet001\Control\CriticalDeviceDatabase\pci#ven_1000&dev_005b" /v Service /t REG_SZ /d percsas2 /f
reg add "HKLM\BM\ControlSet001\Control\CriticalDeviceDatabase\pci#ven_1000&dev_005b" /v ClassGUID /t REG_SZ /d "{4D36E97B-E325-11CE-BFC1-08002BE10318}" /f
reg add "HKLM\BM\ControlSet001\Control\CriticalDeviceDatabase\pci#ven_1000&dev_005b&subsys_1f381028" /v Service /t REG_SZ /d percsas2 /f
reg add "HKLM\BM\ControlSet001\Control\CriticalDeviceDatabase\pci#ven_1000&dev_005b&subsys_1f381028" /v ClassGUID /t REG_SZ /d "{4D36E97B-E325-11CE-BFC1-08002BE10318}" /f
reg unload HKLM\BM
rd /s /q W:\drv
md W:\Windows\Panther
copy /y X:\autounattend.xml W:\Windows\Panther\unattend.xml
md W:\Windows\Setup\Scripts
copy /y X:\SetupComplete.cmd W:\Windows\Setup\Scripts\SetupComplete.cmd
bcdboot W:\Windows /s R: /f BIOS
wpeutil reboot
