Prepare a Windows 11 disk
This guide makes a Windows 11 disk that PCs can boot from over iSCSI. It uses a Hyper-V virtual machine. Other tools such as VMware, VirtualBox or Proxmox also work, but some steps will be a little different.
Dynamic or fixed size disk
Both work with iSCSI. Choose what suits you:
- A dynamic disk file starts small and grows when needed. It saves space, but writing to it is a little slower.
- A fixed size disk file is fastest, but takes up its full size from the start.
Now and then a dynamic disk causes problems. To change a dynamic disk to a fixed size one, change the paths and run:
Convert-VHD -Path "C:\Path\To\Dynamic.vhdx" -DestinationPath "C:\Path\To\Fixed.vhdx" -VHDType Fixed
Hyper-V settings
Set these on the virtual machine:
- At least 4 GB of memory.
- At least 2 processors.
- Use a VHDX disk.
- Turn off Automatic Checkpoints.
- Untick Enable Trusted Platform Module, so BitLocker does not turn on.
- Connect it to a network with internet access.
Set up Windows
These steps assume you have installed Windows, all its updates, and any apps you want.
It helps to turn off BitLocker and stop it turning itself on:
manage-bde -off C:
REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\BitLocker" /v PreventDeviceEncryption /t REG_DWORD /d 1 /f
REG ADD "HKLM\SOFTWARE\Policies\Microsoft\FVE" /v EnableBDEWithNoTPM /t REG_DWORD /d 0 /f
1. Install drivers
Install the network and storage drivers for every PC model that will use this disk. You can add more later. If the disk will only boot Hyper-V virtual machines, you do not need extra drivers.
Next, every network driver that might be used for iSCSI boot must start with Windows. If it does not, Windows stops with an INACCESSIBLE_BOOT_DEVICE blue screen, because the network is not ready in time to keep hold of the disk.
Each network card maker uses a different service name for its driver. Some common ones:
| Network card | Service name |
|---|---|
| Intel I219-LM or I219-V | e1dexpress |
| Intel I210 | e1rexpress |
| Intel I225 or I226 | e2fexpress |
| Realtek | rt640x64 or rtux64w11 |
| Broadcom | b57nd60a |
For each network driver, set Start to 0. Change e1dexpress to your service name:
REG ADD "HKLM\SYSTEM\CurrentControlSet\Services\e1dexpress" /v Start /t REG_DWORD /d 0 /f
Some drivers, mostly newer Intel ones, add a StartOverride key that quietly undoes this. Delete it if it is there:
REG DELETE "HKLM\SYSTEM\CurrentControlSet\Services\e1dexpress\StartOverride" /f
Tip
To find a network card's service name, open Device Manager, right-click the card, choose Properties, go to the Details tab and pick Service from the list.
Tip
The boot start script does this for a long list of drivers at once.
2. Start the iSCSI service with Windows
Set-Service -Name MSiSCSI -StartupType Automatic
Start-Service MSiSCSI
REG ADD "HKLM\SYSTEM\CurrentControlSet\Services\MSiSCSI" /v Start /t REG_DWORD /d 0 /f
REG ADD "HKLM\SYSTEM\CurrentControlSet\Services\iScsiPrt" /v Start /t REG_DWORD /d 0 /f
3. Bring network disks online (optional)
This makes Windows bring new network disks online by itself. Use it if the target has trouble when the PC connects, or the PC hangs while it looks for disks.
REG ADD "HKLM\SYSTEM\CurrentControlSet\Services\partmgr\Parameters" /v SanPolicy /t REG_DWORD /d 1 /f
REG ADD "HKLM\SYSTEM\CurrentControlSet\Services\iScsiPrt\Parameters" /v DontUseReportTargetPortGroups /t REG_DWORD /d 1 /f
4. Turn off hibernation and Fast Startup
These cause a lot of problems over iSCSI, and can make start up much slower.
powercfg /hibernate off
REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Power" /v HiberbootEnabled /t REG_DWORD /d 0 /f
5. Turn off SysMain and Prefetch (optional)
Set-Service SysMain -StartupType Disabled
Stop-Service SysMain -Force
REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\PrefetchParameters" /v EnablePrefetcher /t REG_DWORD /d 0 /f
REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\PrefetchParameters" /v EnableSuperfetch /t REG_DWORD /d 0 /f
6. Turn off scheduled defrag and ReadyBoot (optional)
Disable-ScheduledTask -TaskName "ScheduledDefrag" -TaskPath "\Microsoft\Windows\Defrag\"
REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\WMI\Autologger\ReadyBoot" /v Start /t REG_DWORD /d 0 /f
7. Turn off the page file (optional)
Normally Windows moves memory it is not using to a page file on disk. Over iSCSI this sends a lot of data over the network, which can slow the PC down or even cause a blue screen.
If the PCs have plenty of memory (16 GB or more) but only a 1 Gb network card, turn the page file off, or make it small (1 to 4 GB).
Set-CimInstance -Query "SELECT * FROM Win32_ComputerSystem" -Property @{ AutomaticManagedPagefile = $false }
Get-CimInstance -ClassName Win32_PageFileSetting | Remove-CimInstance
Restart the PC for this to take effect.
8. Change the boot settings
The Windows boot settings (the BCD) may point at a fixed disk, such as partition=C:. Change them to boot, which tells Windows to use whatever disk it started from.
If iSCSI has a problem and Windows fails to start, Windows Recovery may try to "fix" these settings and break them. So turn recovery off too.
bcdedit /set "{bootmgr}" device boot
bcdedit /set "{default}" device boot
bcdedit /set "{default}" osdevice boot
bcdedit /set "{default}" recoveryenabled no
bcdedit /set "{default}" bootstatuspolicy IgnoreAllFailures
bcdedit /deletevalue "{default}" resumeobject
9. Run Sysprep
In most cases you need to run Sysprep, so the disk works on PCs other than the one you built it on.
C:\Windows\System32\Sysprep\sysprep.exe /generalize /oobe /shutdown
Sysprep shuts the PC down. When it next starts, Windows asks you to set it up, like a new PC. Once you have done that, make a copy of the disk file for each PC that will use it.