Code Change Request

# 20855

Back to Code Changes

Christopher
Software Development
StableBit Scanner
Public
Christopher

Ugh, I never actually scripted this. :(  
But I remember most of it (as it ... is simple to me :P)


Well, we need the "raw" StableBit Scanner files. If this is the desktop version, just need to copy the files over. Otherwise, we need a copy of the files. IIRC, we can use MSIEXEC to unpack the files.

And we need a "winpeshl.ini" file with the following contents (this doesn't show up as an ugly command prompt window, but only as a nice, pretty StableBit Scanner UI:
[LaunchApps]
wpeinit
net start scannerservice
"%ProgramFiles%\StableBit\Scanner\UI\Scanner.UI.exe"

And we need the StableBit Scanner store files.

If needed, we can include a custom background. That requires taking permission of and replacing "C:\Windows\Temp\scannerPE\mount\windows\system32\winpe.jpg", which I didn't include in the script. 


After that, we need to run the following commands.

"C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Deployment Tools\DandISetEnv.bat"
copype.cmd x86 C:\Windows\Temp\scannerPE
Dism /Mount-Image /ImageFile:"C:\Windows\Temp\scannerPE\media\sources\boot.wim" /index:1 /MountDir:"C:\Windows\Temp\scannerPE\mount"
xcopy winpeshl.ini C:\Windows\Temp\scannerPE\mount\Windows\System32\
xcopy "Store" "C:\Windows\Temp\scannerPE\mount\ProgramData\StableBit Scanner\Service"
xcopy "C:\Program Files (x86)\StableBit\Scanner" C:\Windows\Temp\scannerPE\mount\ /s
REG LOAD HKLM\STABLEBIT  "C:\Windows\Temp\scannerPE\mount\system32\config\system" 
(need to either merge a pre-created registry file, or use REG to manually add all of the background service config here, under "CurrentControl001", as this mounts the "HKLM\SYSTEM" hive from the image)
REG UNLOAD HKLM\STABLEBIT

Dism /Add-Package /Image:"C:\Windows\Temp\scannerPE\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\WinPE-NetFX.cab"  
Dism /Add-Package /Image:"C:\Windows\Temp\scannerPE\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\en-us\WinPE-NetFX_en-us.cab"

Dism /Add-Package /Image:"C:\Windows\Temp\scannerPE\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\WinPE-WMI.cab"  
Dism /Add-Package /Image:"C:\Windows\Temp\scannerPE\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\en-us\WinPE-WMI_en-us.cab"

Dism /Unmount-Image /MountDir:"C:\WinPE_amd64\mount" /commit


MakeWinPEMedia /UFD C:\Windows\Temp\scannerPE X:
or 
MakeWinPEMedia /ISO C:\Windows\Temp\scannerPE C:\Windows\Temp\scannerPE\WinPE_amd64.iso