You may also be interested in my PowerShell Script to Build a Custom WinPE v3.0 ISO posting. It makes what can be a difficult process much easier!

I have a lot of data migration to do at work to move everything to our new iSCSI based SAN (LeftHand P4000). This week I have dedicated my time to figuring out a way to mount iSCSI targets under our custom WinPE v3.0 (Windows 7 Based) environment. I have not found any resources referring to WinPE v3.0 and only a handful of resources referring to WinPE v2.0 & v2.1. So I’ll post it here to hopefully help others find it.

I was able to adapt information from Microsoft’s iSCSI User Guide and a post here to create the WinPE v3.0 steps below.

Here are the steps I took to get the iSCSI Initiator working. I am assuming you have some sort of experience with customizing WinPE.

  1. Setup a VM with Windows 7 32-bit running because we need the files to be compatible with WinPE 3.0 which is Win7 based.

  2. You need to install WAIK (The Windows 7 version). After installing WAIK and running copype.cmd mount the WinPE boot.wim file using ImageX (or DISM, which I’ve had problems with). The boot.wim file is located in the sources directory. (Note: Installing WAIK and the copype command are not within the scope of this post.)

  3. Copy the following files from Windows 7 to the mounted image while keeping their paths relative. (ie. C:\Windows\System32 = MountLocation\Windows\System32)

Windows\System32\iscsicli.exe
Windows\System32\iscsicpl.exe
Windows\System32\iscsicpl.dll
Windows\System32\iscsidsc.dll
Windows\System32\iscsied.dll
Windows\System32\iscsiexe.dll
Windows\System32\iscsilog.dll
Windows\System32\iscsium.dll
Windows\System32\iscsiwmi.dll
Windows\System32\Drivers\msiscsi.sys
Windows\System32\en-us\iscsicli.exe.mui
Windows\System32\en-us\iscsicpl.dll.mui
Windows\System32\en-us\iscsicpl.exe.mui
Windows\System32\en-us\iscsidsc.dll.mui
Windows\System32\en-us\iscsiexe.dll.mui
Windows\System32\en-us\iscsilog.dll.mui
  1. Using Regedit load the WinPE registry hives directly under HKEY_LOCAL_MACHINE using the names below. This is important in order to import the registry files in the next step. The registry hives can be found at MountLocation\Windows\System32\config.

SYSTEM -> HKLM\PE_Sys SOFTARE -> HLKM\PE_Soft

The REG.EXE commands to do this would be:

REG LOAD HKLM\PE_Sys MountLocation\Windows\System32\config\SYSTEM
REG LOAD HKLM\PE_Soft MountLocation\Windows\System32\config\SOFTWARE
  1. Copy and paste the information below into a .REG file using notepad. Save it. Then import the registry file.
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\PE_Soft\Microsoft\Windows NT\CurrentVersion\Svchost]
"Godzilla"=hex(7):4d,00,53,00,69,00,53,00,43,00,53,00,49,00,00,00,00,00

[HKEY_LOCAL_MACHINE\PE_Soft\Microsoft\Windows NT\CurrentVersion\iSCSI]

[HKEY_LOCAL_MACHINE\PE_Soft\Microsoft\Windows NT\CurrentVersion\iSCSI\Discovery]
"AllowiSNSFirewallException"=dword:00000001

[HKEY_LOCAL_MACHINE\PE_Soft\Microsoft\Windows NT\CurrentVersion\iSCSI\Discovery\Authentication Cache]

[HKEY_LOCAL_MACHINE\PE_Soft\Microsoft\Windows NT\CurrentVersion\iSCSI\Discovery\Send Targets]

[HKEY_LOCAL_MACHINE\PE_Soft\Microsoft\Windows NT\CurrentVersion\iSCSI\Discovery\Static Targets]

[HKEY_LOCAL_MACHINE\PE_Soft\Microsoft\Windows NT\CurrentVersion\iSCSI\Discovery\Tunnel Address]
[HKEY_LOCAL_MACHINE\PE_Sys\ControlSet001\Enum\Root\LEGACY_MSISCSI]
"NextInstance"=dword:00000001

[HKEY_LOCAL_MACHINE\PE_Sys\ControlSet001\Enum\Root\LEGACY_MSISCSI\0000]
"Service"="MSiSCSI"
"Legacy"=dword:00000001
"ConfigFlags"=dword:00000000
"Class"="LegacyDriver"
"ClassGUID"="{8ECC055D-047F-11D1-A537-0000F8753ED1}"
"DeviceDesc"="@%SystemRoot%\\system32\\iscsidsc.dll,-5000"

[HKEY_LOCAL_MACHINE\PE_Sys\ControlSet001\Enum\Root\ISCSIPRT]

[HKEY_LOCAL_MACHINE\PE_Sys\ControlSet001\Enum\Root\ISCSIPRT\0000]
"ClassGUID"="{4d36e97b-e325-11ce-bfc1-08002be10318}"
"Class"="SCSIAdapter"
"HardwareID"=hex(7):52,00,4f,00,4f,00,54,00,5c,00,69,00,53,00,43,00,53,00,49,\
  00,50,00,72,00,74,00,00,00,00,00
"ConfigFlags"=dword:00000000
"Driver"="{4d36e97b-e325-11ce-bfc1-08002be10318}\\0000"
"Mfg"="@iscsi.inf,%msft%;Microsoft"
"Service"="iScsiPrt"
"DeviceDesc"="@iscsi.inf,%iscsiprt%;Microsoft iSCSI Initiator"
"Capabilities"=dword:00000000

[HKEY_LOCAL_MACHINE\PE_Sys\ControlSet001\Enum\Root\ISCSIPRT\0000\Device Parameters]

[HKEY_LOCAL_MACHINE\PE_Sys\ControlSet001\Enum\Root\ISCSIPRT\0000\Device Parameters\StorPort]

[HKEY_LOCAL_MACHINE\PE_Sys\ControlSet001\Enum\Root\ISCSIPRT\0000\LogConf]

[HKEY_LOCAL_MACHINE\PE_Sys\ControlSet001\Enum\Root\ISCSIPRT\0000\Control]
"ActiveService"="iScsiPrt"

[HKEY_LOCAL_MACHINE\PE_Sys\ControlSet001\Services\iScsiPrt]
"DisplayName"="iScsiPort Driver"
"ImagePath"=hex(2):73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,44,00,\
  52,00,49,00,56,00,45,00,52,00,53,00,5c,00,6d,00,73,00,69,00,73,00,63,00,73,\
  00,69,00,2e,00,73,00,79,00,73,00,00,00
"ErrorControl"=dword:00000001
"Start"=dword:00000000
"Type"=dword:00000001

[HKEY_LOCAL_MACHINE\PE_Sys\ControlSet001\Services\iScsiPrt\Parameters]
"BusType"=dword:00000009

[HKEY_LOCAL_MACHINE\PE_Sys\ControlSet001\Services\iScsiPrt\Enum]
"0"="Root\\ISCSIPRT\\0000"
"Count"=dword:00000001
"NextInstance"=dword:00000001

[HKEY_LOCAL_MACHINE\PE_Sys\ControlSet001\Services\MSiSCSI]
"DisplayName"="@%SystemRoot%\\system32\\iscsidsc.dll,-5000"
"Group"="iSCSI"
"ImagePath"=hex(2):25,00,73,00,79,00,73,00,74,00,65,00,6d,00,72,00,6f,00,6f,00,\
  74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,73,\
  00,76,00,63,00,68,00,6f,00,73,00,74,00,2e,00,65,00,78,00,65,00,20,00,2d,00,\
  6b,00,20,00,6e,00,65,00,74,00,73,00,76,00,63,00,73,00,00,00
"Description"="@%SystemRoot%\\system32\\iscsidsc.dll,-5001"
"ObjectName"="LocalSystem"
"ErrorControl"=dword:00000001
"Start"=dword:00000002
"Type"=dword:00000020
"ServiceSidType"=dword:00000001
"RequiredPrivileges"=hex(7):53,00,65,00,41,00,75,00,64,00,69,00,74,00,50,00,72,\
  00,69,00,76,00,69,00,6c,00,65,00,67,00,65,00,00,00,53,00,65,00,43,00,68,00,\
  61,00,6e,00,67,00,65,00,4e,00,6f,00,74,00,69,00,66,00,79,00,50,00,72,00,69,\
  00,76,00,69,00,6c,00,65,00,67,00,65,00,00,00,53,00,65,00,43,00,72,00,65,00,\
  61,00,74,00,65,00,47,00,6c,00,6f,00,62,00,61,00,6c,00,50,00,72,00,69,00,76,\
  00,69,00,6c,00,65,00,67,00,65,00,00,00,53,00,65,00,43,00,72,00,65,00,61,00,\
  74,00,65,00,50,00,65,00,72,00,6d,00,61,00,6e,00,65,00,6e,00,74,00,50,00,72,\
  00,69,00,76,00,69,00,6c,00,65,00,67,00,65,00,00,00,53,00,65,00,49,00,6d,00,\
  70,00,65,00,72,00,73,00,6f,00,6e,00,61,00,74,00,65,00,50,00,72,00,69,00,76,\
  00,69,00,6c,00,65,00,67,00,65,00,00,00,53,00,65,00,54,00,63,00,62,00,50,00,\
  72,00,69,00,76,00,69,00,6c,00,65,00,67,00,65,00,00,00,00,00
"FailureActionsOnNonCrashFailures"=dword:00000001
"FailureActions"=hex:50,46,00,00,01,00,00,00,01,00,00,00,03,00,00,00,14,00,00,\
  00,01,00,00,00,c0,d4,01,00,01,00,00,00,e0,93,04,00,00,00,00,00,00,00,00,00
"RebootMessage"="See Note 3 below"
"FailureCommand"="customScript.cmd"

[HKEY_LOCAL_MACHINE\PE_Sys\ControlSet001\Services\MSiSCSI\Parameters]
"ServiceDll"=hex(2):25,00,73,00,79,00,73,00,74,00,65,00,6d,00,72,00,6f,00,6f,\
  00,74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,\
  69,00,73,00,63,00,73,00,69,00,65,00,78,00,65,00,2e,00,64,00,6c,00,6c,00,00,\
  00
"ServiceDllUnloadOnStop"=dword:00000001

[HKEY_LOCAL_MACHINE\PE_Sys\ControlSet001\Services\MSiSCSI\Enum]
"0"="Root\\LEGACY_MSISCSI\\0000"
"Count"=dword:00000001
"NextInstance"=dword:00000001

[HKEY_LOCAL_MACHINE\PE_Sys\ControlSet001\Services\netbt]
"Start"=dword:00000000

[HKEY_LOCAL_MACHINE\PE_Sys\ControlSet001\Services\AFD]
"Start"=dword:00000000

[HKEY_LOCAL_MACHINE\PE_Sys\ControlSet001\Services\Tcpip]
"Start"=dword:00000001

[HKEY_LOCAL_MACHINE\PE_Sys\ControlSet001\Services\MSiSCSI]
"ImagePath"=hex(2):25,00,73,00,79,00,73,00,74,00,65,00,6d,00,72,00,6f,00,6f,00,\
  74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,73,\
  00,76,00,63,00,68,00,6f,00,73,00,74,00,2e,00,65,00,78,00,65,00,20,00,2d,00,\
  6b,00,20,00,47,00,6f,00,64,00,7a,00,69,00,6c,00,6c,00,61,00,00,00

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\PE_Sys\ControlSet001\Control\Class\{4D36E97B-E325-11CE-BFC1-08002BE10318}]
"LegacyAdapterDetection"=dword:00000000
"Class"="SCSIAdapter"
"ClassDesc"="@%SystemRoot%\\System32\\SysClass.Dll,-3005"
@="@%SystemRoot%\\System32\\SysClass.Dll,-3005"
"IconPath"=hex(7):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,\
  74,00,25,00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,73,\
  00,65,00,74,00,75,00,70,00,61,00,70,00,69,00,2e,00,64,00,6c,00,6c,00,2c,00,\
  2d,00,31,00,30,00,00,00,00,00
"Installer32"="SysClass.Dll,ScsiClassInstaller"

[HKEY_LOCAL_MACHINE\PE_Sys\ControlSet001\Control\Class\{4D36E97B-E325-11CE-BFC1-08002BE10318}\0000]
"InfPath"="iscsi.inf"
"InfSection"="iScsiPort_Install_Control"
"ProviderName"="Microsoft"
"DriverDateData"=hex:00,80,8c,a3,c5,94,c6,01
"DriverDate"="6-21-2006"
"DriverVersion"="6.0.6000.16386"
"MatchingDeviceId"="root\\iscsiprt"
"DriverDesc"="Microsoft iSCSI Initiator"
"EnumPropPages32"="iscsipp.dll,iSCSIPropPageProvider"

[HKEY_LOCAL_MACHINE\PE_Sys\ControlSet001\Control\Class\{4D36E97B-E325-11CE-BFC1-08002BE10318}\0000\Parameters]
"TCPConnectTime"=dword:0000000f
"TCPDisconnectTime"=dword:0000000f
"WMIRequestTimeout"=dword:0000001e
"DelayBetweenReconnect"=dword:00000005
"MaxPendingRequests"=dword:000000ff
"EnableNOPOut"=dword:00000000
"MaxTransferLength"=dword:00040000
"MaxBurstLength"=dword:00040000
"FirstBurstLength"=dword:00010000
"MaxRecvDataSegmentLength"=dword:00010000
"MaxConnectionRetries"=dword:ffffffff
"MaxRequestHoldTime"=dword:0000003c
"LinkDownTime"=dword:0000000f
"IPSecConfigTimeout"=dword:0000003c
"InitialR2T"=dword:00000000
"ImmediateData"=dword:00000001
"ErrorRecoveryLevel"=dword:00000002
"PortalRetryCount"=dword:00000005
"NetworkReadyRetryCount"=dword:0000000a
"SrbTimeoutDelta"=dword:0000000f

[HKEY_LOCAL_MACHINE\PE_Sys\ControlSet001\Control\Class\{4D36E97B-E325-11CE-BFC1-08002BE10318}\0000\PersistentTargets]
@=""

[HKEY_LOCAL_MACHINE\PE_Sys\ControlSet001\Control\Class\{4D36E97B-E325-11CE-BFC1-08002BE10318}\Properties]
"DeviceType"=dword:00000004
"DeviceCharacteristics"=dword:00000100
"Security"=hex:01,00,04,90,00,00,00,00,00,00,00,00,00,00,00,00,14,00,00,00,02,\
  00,34,00,02,00,00,00,00,00,14,00,ff,01,1f,10,01,01,00,00,00,00,00,05,12,00,\
  00,00,00,00,18,00,ff,01,1f,10,01,02,00,00,00,00,00,05,20,00,00,00,20,02,00,\
  00
  1. Using Regedit, find the PE_Soft and PE_Sys hives under HKEY_LOCAL_MACHINE and unload them.

  2. Unmount the WIM (Don’t forget to /commit)

  3. It’s now modified and you can use OSCDIMG to make your CD image or copy the ISO folder to your bootable USB drive.

  4. Once you have booted into your custom WinPE 3.0 environment you need to start the msiscsi service:

net start msiscsi

Starting the iSCSI Service

  1. Now run the iSCSI Initiator tool:
iscsicpl

You’re all set. You can now use iSCSI just as you can in an actual Windows installation. Since Disk Manager is not in WinPE you can use Diskpart to setup your disks after you’ve connected to them via. iSCSI.



Gregory Strike

Husband, father, IT dude & blogger wrapped up into one good looking package.