T
tryllzhuud
Hi,
I"m trying to read data from a csv file then add the corresponding rows of IP address to the iSCSI Targetname, however I'm unable to understand how to actually do it with powershell since the format is side-by-side.
-InitiatorId @("IPAddress:10.10.1.1","IPAddress:10.10.1.2")
And I'm unable to understand how to add IP addresses to the -InitiatorId.
This is my script, and that I'm trying to add the 4 IP addresses from the result to 2 Targetnames, esxi1Hosts, and esxi2Hosts on each disk.
New-IscsiVirtualDisk -Path "F:\iSCSI1.vhdx" -Size 256GB
New-IscsiVirtualDisk -Path "G:\iSCSI2.vhdx" -Size 256GB
$csvFile = Import-CSV -Path C:\Users\Administrator\Desktop\esxiHostsDeployment.csv
foreach ($NFSRow in $csvFile)
{
$virtualSwitch = $NFSRow.Switch
$vmK = $NFSRow.VMK
$ip = $NFSRow.IP
if ($vmK -contains 'iSCSI1' -or $vmK -contains 'iSCSI2')
{
New-IscsiServerTarget -TargetName "esxiHosts1" -InitiatorId @("IPAddress:$ip")
}
}
Thank You
Continue reading...
I"m trying to read data from a csv file then add the corresponding rows of IP address to the iSCSI Targetname, however I'm unable to understand how to actually do it with powershell since the format is side-by-side.
-InitiatorId @("IPAddress:10.10.1.1","IPAddress:10.10.1.2")
And I'm unable to understand how to add IP addresses to the -InitiatorId.
This is my script, and that I'm trying to add the 4 IP addresses from the result to 2 Targetnames, esxi1Hosts, and esxi2Hosts on each disk.
New-IscsiVirtualDisk -Path "F:\iSCSI1.vhdx" -Size 256GB
New-IscsiVirtualDisk -Path "G:\iSCSI2.vhdx" -Size 256GB
$csvFile = Import-CSV -Path C:\Users\Administrator\Desktop\esxiHostsDeployment.csv
foreach ($NFSRow in $csvFile)
{
$virtualSwitch = $NFSRow.Switch
$vmK = $NFSRow.VMK
$ip = $NFSRow.IP
if ($vmK -contains 'iSCSI1' -or $vmK -contains 'iSCSI2')
{
New-IscsiServerTarget -TargetName "esxiHosts1" -InitiatorId @("IPAddress:$ip")
}
}
Thank You
Continue reading...