How to Set Up iSCSI Target Server on Windows Server 2022

iSCSI (Internet Small Computer Systems Interface) is a block-level storage protocol that transports SCSI commands over TCP/IP networks. Windows Server 2022 includes a built-in iSCSI Target Server role that allows you to create and expose virtual disk images (VHDs or VHDXs) to initiators — clients that connect over the network and see the virtual disk as a locally attached storage device. This is widely used to provide shared storage for Hyper-V clusters, SQL Server instances, or any application requiring block-level access to remote storage without a dedicated SAN.

Planning Your iSCSI Deployment

Before installation, plan your network topology. iSCSI traffic should be isolated on a dedicated network separate from your management and production traffic. This prevents storage I/O from competing with application traffic and reduces broadcast domain complexity. Assign static IP addresses to the storage NICs on both the target server and all initiator machines.

For production deployments, use at least two storage NICs per server and configure MPIO (Multipath I/O) to provide both redundancy and load balancing across paths. Jumbo frames (MTU 9000) should be enabled on all storage NICs and switches in the storage network to improve iSCSI throughput by reducing CPU overhead from packet fragmentation.

iSCSI uses TCP port 3260. Ensure your host firewall and any network firewalls permit TCP 3260 between initiators and the target server’s storage IP addresses.

Installing the iSCSI Target Server Role

The iSCSI Target Server is a feature under the File and Storage Services role. Install it using PowerShell:

Install-WindowsFeature -Name FS-iSCSITarget-Server -IncludeManagementTools

This installs the iSCSI Target Server service (WinTarget), the iSCSI Target Server PowerShell module (iSCSITarget), and the iSCSI Target Server snap-in for Server Manager. No reboot is typically required. Verify the installation:

Get-WindowsFeature -Name FS-iSCSITarget-Server | Select DisplayName, InstallState

# Verify the WinTarget service is running
Get-Service -Name WinTarget | Select Status, StartType

Creating iSCSI Virtual Disks

iSCSI virtual disks are VHD or VHDX files that the target server presents to initiators as raw block devices. The iSCSI Target Server module uses New-IscsiVirtualDisk to create these files. Store the VHDs on an NTFS or ReFS volume with enough free space:

# Create a fixed-size VHDX (better performance than dynamic for production)
New-IscsiVirtualDisk -Path "D:iSCSIVirtualDisksLUN01.vhdx" -SizeBytes 500GB

# Create a dynamically expanding VHDX (for test environments)
New-IscsiVirtualDisk -Path "D:iSCSIVirtualDisksLUN02.vhdx" -SizeBytes 200GB -UseFixed $false

# Create a differencing disk (child disk backed by a parent VHD)
New-IscsiVirtualDisk -Path "D:iSCSIVirtualDisksLUN03-diff.vhdx" -ParentPath "D:iSCSIVirtualDisksLUN01.vhdx"

List all configured virtual disks to confirm creation:

Get-IscsiVirtualDisk | Select Path, SizeBytes, DiskType, Status | Format-Table -AutoSize

Creating iSCSI Targets

An iSCSI target is an endpoint that initiators connect to. Each target has an IQN (iSCSI Qualified Name), a globally unique identifier in the format iqn.YYYY-MM.reversed-domain:identifier. You associate one or more virtual disks with a target, and restrict access to specific initiator IQNs:

# Create an iSCSI target — specify which initiator IQNs are allowed
New-IscsiServerTarget -TargetName "sqlserver-lun01" -InitiatorIds @("IQN:iqn.1991-05.com.microsoft:sqlnode01.contoso.com")

# Create a target accessible by multiple initiators (for a cluster)
New-IscsiServerTarget -TargetName "hvcluster-quorum" -InitiatorIds @(
    "IQN:iqn.1991-05.com.microsoft:hvnode01.contoso.com",
    "IQN:iqn.1991-05.com.microsoft:hvnode02.contoso.com",
    "IQN:iqn.1991-05.com.microsoft:hvnode03.contoso.com"
)

Now associate the virtual disks with the target:

# Add a virtual disk to the target (LUN ID 0 is assigned automatically)
Add-IscsiVirtualDiskTargetMapping -TargetName "sqlserver-lun01" -Path "D:iSCSIVirtualDisksLUN01.vhdx"

# Add a second disk to the same target as LUN 1
Add-IscsiVirtualDiskTargetMapping -TargetName "sqlserver-lun01" -Path "D:iSCSIVirtualDisksLUN02.vhdx" -Lun 1

# Verify the target configuration
Get-IscsiServerTarget -TargetName "sqlserver-lun01" | Select TargetName, LunMappings, InitiatorIds, Status

Finding Initiator IQNs

To restrict access to specific initiators, you need each initiator’s IQN. On a Windows initiator machine, open iSCSI Initiator (iscsicpl.exe) and check the Configuration tab to find the Initiator Name (IQN). Via PowerShell on the initiator:

# Run on the initiator machine
(Get-InitiatorPort | Where-Object { $_.ConnectionType -eq 'iSCSI' }).NodeAddress

On a Linux initiator, the IQN is stored in /etc/iscsi/initiatorname.iscsi:

cat /etc/iscsi/initiatorname.iscsi

Configuring CHAP Authentication

By default, any initiator with the correct IQN can connect. CHAP (Challenge Handshake Authentication Protocol) adds a username/password layer. One-way CHAP has the target authenticate the initiator. Mutual CHAP has both sides authenticate each other:

# Set one-way CHAP on a target (initiator must supply these credentials)
Set-IscsiServerTarget -TargetName "sqlserver-lun01" -ChapUserName "sqlinituser" -ChapSecret "P@ssw0rd123456!"

# Enable CHAP enforcement on the target
Set-IscsiServerTarget -TargetName "sqlserver-lun01" -EnableChap $true

# For mutual CHAP (target also authenticates itself to initiator)
Set-IscsiServerTarget -TargetName "sqlserver-lun01" -EnableMutualChap $true -ReverseChapUserName "targetauthuser" -ReverseChapSecret "R3vers3P@ss!"

CHAP secrets must be 12–16 characters. On the Windows initiator side, configure the CHAP credentials in the iSCSI Initiator app under Advanced settings when creating the target portal connection.

Connecting the Windows iSCSI Initiator

On the initiator machine, the iSCSI Initiator service (MSiSCSI) must be running and set to start automatically:

Start-Service -Name MSiSCSI
Set-Service -Name MSiSCSI -StartupType Automatic

Connect to the iSCSI target using PowerShell on the initiator:

# Discover targets on the target server
Get-IscsiTargetPortal | Remove-IscsiTargetPortal -Confirm:$false  # clean up old portals if needed
New-IscsiTargetPortal -TargetPortalAddress "192.168.100.10" -TargetPortalPortNumber 3260

# List discovered targets
Get-IscsiTarget

# Connect to the target
Connect-IscsiTarget -NodeAddress "iqn.1991-05.com.microsoft:targetserver-sqlserver-lun01-target" -TargetPortalAddress "192.168.100.10" -IsPersistent $true

# For CHAP authentication
Connect-IscsiTarget -NodeAddress "iqn.1991-05.com.microsoft:targetserver-sqlserver-lun01-target" -TargetPortalAddress "192.168.100.10" -AuthenticationType ONEWAYCHAP -ChapUsername "sqlinituser" -ChapSecret "P@ssw0rd123456!" -IsPersistent $true

After connecting, the LUN appears as a raw disk in Disk Management (diskmgmt.msc). Initialize the disk, create a partition, and format it like any local disk.

Installing and Configuring MPIO for iSCSI

MPIO allows the initiator to maintain multiple simultaneous paths to the target, providing both failover and load balancing. Install the Multipath I/O feature on the initiator:

Install-WindowsFeature -Name Multipath-IO -IncludeManagementTools
Restart-Computer

After reboot, enable MPIO for iSCSI devices:

# Enable MPIO to claim iSCSI devices
Enable-MSDSMAutomaticClaim -BusType iSCSI

# Configure the load balancing policy (Round Robin recommended for iSCSI)
Set-MSDSMGlobalDefaultLoadBalancePolicy -Policy RR

# Add additional target portals for multiple paths (second NIC on target)
New-IscsiTargetPortal -TargetPortalAddress "192.168.101.10" -TargetPortalPortNumber 3260

# Connect to the target again via the second path
Connect-IscsiTarget -NodeAddress "iqn.1991-05.com.microsoft:targetserver-sqlserver-lun01-target" -TargetPortalAddress "192.168.101.10" -IsPersistent $true

# Verify MPIO paths
Get-MSDSMConnection | Format-Table -AutoSize

Monitoring iSCSI Sessions

On the target server, monitor active initiator sessions using the iSCSI Target PowerShell module:

# List all active iSCSI sessions to this server
Get-IscsiSession | Select InitiatorNodeAddress, TargetNodeAddress, ConnectionCount, IsConnected | Format-Table -AutoSize

# Get detailed session info including initiator IP
Get-IscsiConnection | Select ConnectionIdentifier, InitiatorAddress, TargetAddress, TargetPortNumber | Format-Table -AutoSize

# Check iSCSI server target status
Get-IscsiServerTarget | Select TargetName, Status, InitiatorIds, LunMappings | Format-List

On the initiator side:

# List active sessions from initiator perspective
Get-IscsiSession | Select TargetNodeAddress, IsConnected, NumberOfConnections, SessionIdentifier

# Get MPIO disk path information
Get-Disk | Where-Object { $_.BusType -eq 'iSCSI' } | Get-MSDSMConnection

iSCSI Performance Tuning

Several settings improve iSCSI throughput and latency. On the target server, ensure the iSCSI Target Server service has high I/O priority. On both target and initiator NICs, disable interrupt coalescing for low-latency workloads, or enable it for high-throughput workloads:

# Disable TCP offload engine selectively (sometimes causes issues with iSCSI)
# Only disable if experiencing connectivity problems
netsh int tcp set global chimney=disabled

# Enable jumbo frames on the storage NIC (MTU 9014)
Set-NetAdapterAdvancedProperty -Name "Storage NIC" -RegistryKeyword "*JumboPacket" -RegistryValue 9014

# Verify jumbo frames setting
Get-NetAdapterAdvancedProperty -Name "Storage NIC" -RegistryKeyword "*JumboPacket"

# Set receive buffer size on storage NIC for higher throughput
Set-NetAdapterAdvancedProperty -Name "Storage NIC" -RegistryKeyword "*ReceiveBuffers" -RegistryValue 4096

For SQL Server iSCSI LUNs, pre-allocate the VHDX as a fixed-size disk to avoid dynamic expansion overhead during production I/O. Format SQL data volumes with 64 KB allocation unit size in Disk Management or via diskpart for optimal SQL Server block alignment.

Configuring iSCSI with the Target Server Snap-in

Server Manager includes an iSCSI graphical interface under File and Storage Services > iSCSI. The wizard guides you through creating virtual disks and targets in a single flow. It is suitable for smaller deployments but lacks the automation capabilities of PowerShell. For large-scale or scripted provisioning of many LUNs, use the iSCSITarget PowerShell module exclusively.

The Windows Server 2022 iSCSI Target Server supports online virtual disk extension (increasing LUN size without downtime), snapshots (hardware VSS snapshots of iSCSI VHDs), and iSCSI disk cloning for rapid provisioning of test environments from production disk snapshots.

# Resize an existing iSCSI virtual disk online (initiator must rescan after)
Resize-IscsiVirtualDisk -Path "D:iSCSIVirtualDisksLUN01.vhdx" -SizeBytes 1TB

# On the initiator, rescan to pick up the size change
Update-Disk -Number (Get-Disk | Where-Object BusType -eq 'iSCSI').Number

The Windows Server 2022 iSCSI Target Server is a cost-effective shared block storage solution for environments where a dedicated hardware SAN is not justified. With proper network isolation, MPIO, CHAP authentication, and jumbo frames, it delivers reliable performance for most small to medium workloads.