Post

Win2012 R2 Core iSCSI Configuration with PowerShell

Win2012 R2 Core iSCSI Configuration with PowerShell

Configuring iSCSI on Windows Server 2012 R2 Core

This guide demonstrates how to configure iSCSI connections on Windows Server 2012 R2 Core using PowerShell commands.

1. Start and Configure the iSCSI Service

First, set the iSCSI service to start automatically and start it:

1
2
3
4
5
6
7
8
# Set iSCSI service to start automatically
Set-Service -Name MSiSCSI -StartupType Automatic

# Start the iSCSI service
Start-Service MSiSCSI

# Verify the service is running
Get-Service -Name MSiSCSI

Example output:

1
2
3
Status Name    DisplayName
------ ----    -----------
Running MSiSCSI Microsoft iSCSI Initiator Service

2. Register the iSCSI Target Portal

Add the iSCSI storage array’s IP address as a target portal:

1
2
# Register the iSCSI target portal
New-IscsiTargetPortal -TargetPortalAddress 192.168.105.28

Example output:

1
2
3
4
5
6
7
InitiatorInstanceName   :
InitiatorPortalAddress  :
IsDataDigest           : False
IsHeaderDigest         : False
TargetPortalAddress    : 192.168.105.28
TargetPortalPortNumber : 3260
PSComputerName         :

3. Verify Available iSCSI Targets

Check which iSCSI targets are available from the portal:

1
2
# List available iSCSI targets
Get-IscsiTarget

Example output:

1
2
3
4
IsConnected NodeAddress                                      PSComputerName
----------- -----------                                      --------------
False       iqn.2001-05.com.equallogic:4-52aed6-...
False       iqn.2001-05.com.equallogic:4-52aed6-...

4. Connect to iSCSI Targets

Connect to the desired iSCSI targets using their node addresses:

1
2
3
4
5
# Connect to the first iSCSI target
Connect-IscsiTarget -NodeAddress iqn.2001-05.com.equallogic:4-52aed6-6e50a7eb3-43e0000002c53994-hyper-v-01

# Connect to the second iSCSI target
Connect-IscsiTarget -NodeAddress iqn.2001-05.com.equallogic:4-52aed6-58e0a7eb3-ec20000003453aa7-hyper-v-02

5. Verify iSCSI Connections

Check the active iSCSI connections:

1
2
# List all active iSCSI connections
Get-IscsiConnection

Example output:

1
2
3
4
5
6
7
8
9
10
11
12
13
ConnectionIdentifier : ffffe00011e2b020-2
InitiatorAddress     : 0.0.0.0
InitiatorPortNumber  : 31188
TargetAddress        : 192.168.105.28
TargetPortNumber     : 3260
PSComputerName       :

ConnectionIdentifier : ffffe00011e2b020-4
InitiatorAddress     : 0.0.0.0
InitiatorPortNumber  : 31700
TargetAddress        : 192.168.105.28
TargetPortNumber     : 3260
PSComputerName       :

6. Make iSCSI Connections Persistent

Register the iSCSI sessions to persist across system reboots:

1
2
3
4
5
6
# Get all iSCSI sessions
Get-IscsiSession

# Register sessions to persist across reboots
Register-IscsiSession -SessionIdentifier ffffe00011e2b020-4000013700000003
Register-IscsiSession -SessionIdentifier ffffe00011e2b020-4000013700000004

7. View Connected iSCSI Disks

List all iSCSI disks connected to the system:

1
2
# List all iSCSI disks
Get-Disk | Where-Object BusType -eq "iSCSI"

Example output:

1
2
3
4
Number Friendly Name                    OperationalStatus Total Size Partition Style
------ ------------                    ----------------- ---------- ---------------
3      EQLOGIC 100E-00 SCSI Disk Device Offline          400 GB     GPT
4      EQLOGIC 100E-00 SCSI Disk Device Offline          200.01 GB  GPT

Next Steps

After connecting the iSCSI disks, you may need to:

  • Initialize the disks
  • Create volumes
  • Format the volumes with a file system
  • Assign drive letters or mount points

These tasks can be performed using the Initialize-Disk, New-Partition, Format-Volume, and Add-PartitionAccessPath PowerShell cmdlets.

This post is licensed under CC BY 4.0 by the author.