This is a quick and basic example of configuring iSCSI portal and iSCSI targets with PowerShell
#set iSCSI Initiator Service to Automatic start
Set-Service -Name msiscsi -StartupType Automatic
#start service
Start-Service msiscsi
# to check if working: Get-WindowsOptionalFeature –Online –FeatureName MultiPathIO
# enable MPIO
Enable-WindowsOptionalFeature –Online –FeatureName MultiPathIO
# to remove: Disable-WindowsOptionalFeature –Online –FeatureName MultiPathIO
# enable and set the policy
# reboot will likely be required at some point with the next two commands
Enable-MSDSMAutomaticClaim -BusType iSCSI
#--------------------------------------------------
Set-MSDSMGlobalDefaultLoadBalancePolicy -Policy RR
#--------------------------------------------------
# Configure the iSCSI target portal
New-IscsiTargetPortal –TargetPortalAddress 10.0.1.2
# quorum drive
$target = Get-IscsiTarget -NodeAddress iqn.address
$target| Connect-IscsiTarget -IsPersistent $true -IsMultipathEnabled $true -InitiatorPortalAddress 10.0.1.20 -TargetPortalAddress 10.0.1.2
#HyperVStorage
$target2 = Get-IscsiTarget -NodeAddress iqn.address
$target2| Connect-IscsiTarget -IsPersistent $true -IsMultipathEnabled $true -InitiatorPortalAddress 10.0.1.20 -TargetPortalAddress 10.0.1.2
#HyperVVMs
$target3 = Get-IscsiTarget -NodeAddress iqn.address
$target3| Connect-IscsiTarget -IsPersistent $true -IsMultipathEnabled $true -InitiatorPortalAddress 10.0.1.20 -TargetPortalAddress 10.0.1.2
# to remove: Disconnect-IscsiTarget