Win2012 R2 Core iSCSI configuration with PowerShell

Start relevant services and set to auto start:
——————————————————————-
[A4C1A4b.dsc.local]: PS C:\Users\administrator.DSC\Documents> Set-Service –Name MSiSCSI –StartupType Automatic
[A4C1A4b.dsc.local]: PS C:\Users\administrator.DSC\Documents> Start-Service MSiSCSI
[A4C1A4b.dsc.local]: PS C:\Users\administrator.DSC\Documents> Get-Service –Name MSiSCSI

Status Name DisplayName
—— —- ———–
Running MSiSCSI Microsoft iSCSI Initiator Service

Register the iSCSI array IP address:
——————————————————————-
[A4C1A4b.dsc.local]: PS C:\Users\administrator.DSC\Documents> New-IscsiTargetPortal –TargetPortalAddress 192.168.105.28
InitiatorInstanceName :
InitiatorPortalAddress :
IsDataDigest : False
IsHeaderDigest : False
TargetPortalAddress : 192.168.105.28
TargetPortalPortNumber : 3260
PSComputerName :
[A4C1A4b.dsc.local]: PS C:\Users\administrator.DSC\Documents>

Verify connectivity:
————————————————————————————–
[A4C1A4b.dsc.local]: PS C:\Users\administrator.DSC\Documents> Get-IscsiTarget

IsConnected NodeAddress PSComputerName
———– ———– ————–
False iqn.2001-05.com.equallogic:4-52aed6-…
False iqn.2001-05.com.equallogic:4-52aed6-…

Check the iscsi target names in the EQL gui and use to connect:
——————————————————————-
[A4C1A4b.dsc.local]: PS C:\Users\administrator.DSC\Documents> Connect-IscsiTarget –NodeAddress iqn.2001-05.com.equallogic:4-52aed6-6e50a7eb3-43e0000002c53994-hyper-v-01

AuthenticationType      : NONE
InitiatorInstanceName   : ROOT\ISCSIPRT\0000_0
InitiatorNodeAddress    : iqn.1991-05.com.microsoft:a4c1a4b.dsc.local
InitiatorPortalAddress  : 0.0.0.0
InitiatorSideIdentifier : 400001370000
IsConnected             : True
IsDataDigest            : False
IsDiscovered            : True
IsHeaderDigest          : False
IsPersistent            : False
NumberOfConnections     : 1
SessionIdentifier       : ffffe00011e2b020-4000013700000003
TargetNodeAddress       : iqn.2001-05.com.equallogic:4-52aed6-6e50a7eb3-43e0000002c53994-hyper-v-01
TargetSideIdentifier    : 5500
PSComputerName          :

[A4C1A4b.dsc.local]: PS C:\Users\administrator.DSC\Documents> Connect-IscsiTarget –NodeAddress iqn.2001-05.com.equallogic:4-52aed6-58e0a7eb3-ec20000003453aa7-hyper-v-02

AuthenticationType      : NONE
InitiatorInstanceName   : ROOT\ISCSIPRT\0000_0
InitiatorNodeAddress    : iqn.1991-05.com.microsoft:a4c1a4b.dsc.local
InitiatorPortalAddress  : 0.0.0.0
InitiatorSideIdentifier : 400001370000
IsConnected             : True
IsDataDigest            : False
IsDiscovered            : True
IsHeaderDigest          : False
IsPersistent            : False
NumberOfConnections     : 1
SessionIdentifier       : ffffe00011e2b020-4000013700000004
TargetNodeAddress       : iqn.2001-05.com.equallogic:4-52aed6-58e0a7eb3-ec20000003453aa7-hyper-v-02
TargetSideIdentifier    : 5600
PSComputerName          :

Verify connections:
————————————————————
[A4C1A4b.dsc.local]: PS C:\Users\administrator.DSC\Documents> Get-IscsiConnection
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 :

[A4C1A4b.dsc.local]: PS C:\Users\administrator.DSC\Documents>

 

Register the session so it persists across reboots:
————————————————————
[A4C1A4b.dsc.local]: PS C:\Users\administrator.DSC\Documents> Get-IscsiSession

AuthenticationType : NONE
InitiatorInstanceName : ROOT\ISCSIPRT\0000_0
InitiatorNodeAddress : iqn.1991-05.com.microsoft:a4c1a4b.dsc.local
InitiatorPortalAddress : 0.0.0.0
InitiatorSideIdentifier : 400001370000
IsConnected : True
IsDataDigest : False
IsDiscovered : True
IsHeaderDigest : False
IsPersistent : True
NumberOfConnections : 1
SessionIdentifier : ffffe00011e2b020-4000013700000003
TargetNodeAddress : iqn.2001-05.com.equallogic:4-52aed6-6e50a7eb3-43e0000002c53994-hyper-v-01
TargetSideIdentifier : 5500
PSComputerName :

AuthenticationType : NONE
InitiatorInstanceName : ROOT\ISCSIPRT\0000_0
InitiatorNodeAddress : iqn.1991-05.com.microsoft:a4c1a4b.dsc.local
InitiatorPortalAddress : 0.0.0.0
InitiatorSideIdentifier : 400001370000
IsConnected : True
IsDataDigest : False
IsDiscovered : True
IsHeaderDigest : False
IsPersistent : False
NumberOfConnections : 1
SessionIdentifier : ffffe00011e2b020-4000013700000004
TargetNodeAddress : iqn.2001-05.com.equallogic:4-52aed6-58e0a7eb3-ec20000003453aa7-hyper-v-02
TargetSideIdentifier : 5600
PSComputerName :

[A4C1A4b.dsc.local]: PS C:\Users\administrator.DSC\Documents> Register-IscsiSession -SessionIdentifier ffffe00011e2b020-4000013700000003
[A4C1A4b.dsc.local]: PS C:\Users\administrator.DSC\Documents> Register-IscsiSession -SessionIdentifier ffffe00011e2b020-4000013700000004
[A4C1A4b.dsc.local]: PS C:\Users\administrator.DSC\Documents>
[A4C1A4b.dsc.local]: PS C:\Users\administrator.DSC\Documents>
[A4C1A4b.dsc.local]: PS C:\Users\administrator.DSC\Documents>
[A4C1A4b.dsc.local]: PS C:\Users\administrator.DSC\Documents>
[A4C1A4b.dsc.local]: PS C:\Users\administrator.DSC\Documents> Get-Disk | Where-Object BusType –eq “iSCSI”

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

[A4C1A4b.dsc.local]: PS C:\Users\administrator.DSC\Documents>

Leave a Reply