How to Create an iSCSI Target and Virtual Disk on Windows Server
Applies to: Windows Server 2019, 2022 and 2025.
The iSCSI Target Server role presents block storage to authorized initiators. Incorrect initiator mapping can expose a disk to the wrong host and corrupt data.
Storage changes can cause data loss or access outages. Use tested backups, maintenance windows and representative access tests. Managed Windows VPS services are available at networkmanager.info.
Prerequisites
- Use dedicated storage and network paths.
- Record initiator IQNs.
- Choose virtual-disk size and resilience.
- Never present a non-cluster-aware writable disk to multiple hosts.
Procedure
Step 1: Install role
Add iSCSI Target Server tools.
Install-WindowsFeature FS-iSCSITarget-Server -IncludeManagementToolsStep 2: Create virtual disk
Use a dedicated path and approved size.
New-IscsiVirtualDisk -Path 'D:\iSCSI\AppData.vhdx' -Size 200GBStep 3: Create target
Restrict by initiator IQN.
New-IscsiServerTarget -TargetName 'AppServer01' -InitiatorIds 'IQN:iqn.1991-05.com.microsoft:app01.corp.example'Step 4: Map disk
Attach the virtual disk to the target.
Add-IscsiVirtualDiskTargetMapping -TargetName 'AppServer01' -Path 'D:\iSCSI\AppData.vhdx'Step 5: Connect initiator
Discover and connect from the approved host, then initialize the new disk there.
Verification
Review target, mapping and active sessions.
Get-IscsiServerTarget
Get-IscsiVirtualDisk
Get-IscsiTargetServerSettingRollback and recovery
Disconnect the initiator and remove the mapping before removing target or virtual disk. Preserve the VHDX until data migration and backup are confirmed.
Operational notes
Use CHAP, network isolation and firewall scope as required by the security design.