Hi,
I'm writing a script to configure the iscsi initiator on multiple hosts and have come up with this
Import-Csv -Path "c:\Tools\Powershell\CSV\hostconfig.csv" | %{
$StorageSystem = Get-View (Get-VMHostStorage -VMHost (Get-VMHost -Name $_.esxHost)).ID
$StorageSystem.UpdateSoftwareInternetScsiEnabled( $true )
$StorageSystem.StorageDeviceInfo.HostBusAdapter | where {$_.GetType().Name -eq "HostInternetScsiHba"} | %{
$HbaName = $_.Device
}
$initName = $_.initname
$StorageSystem.UpdateInternetScsiName $initName
$iSendTarget1 = New-Object VMware.Vim.HostInternetScsiHbaSendTarget
$iSendTarget1.Address = "10.10.10.1"
$iSendTarget1.Port = "3260"
$SendTargets = $iSendTarget1
$StorageSystem.AddInternetScsiSendTargets( $HbaName, $SendTargets )
Get-VMHostStorage -VMHost $hst -RescanAllHba -RescanVmfs
}
I am however stuck as to changing the initiator name. I need to do this for security on my SAN. I have used a csv file for the main variables and can extract the new name I want to set, but I cannot figure out how to set it.
Any help would be appreciated.
Thanks,
Alasdair..............