param ( $VMHostName, $HbaName ) $StorageSystem = Get-VMHost $VMHostName | Get-VMHostStorage | Get-View # ------------------------------------------------------------------- # Uncomment this line if you use software iSCSI # ------------------------------------------------------------------- # $StorageSystem.UpdateSoftwareInternetScsiEnabled( $true ) # ------------------------------------------------------------------- # HBA IP Address # Uncomment and use this section if you use a hardware iSCSI HBA (initiator) # ------------------------------------------------------------------- # $iIPSpec = New-Object VMware.Vim.HostInternetScsiHbaIPProperties # $iIPSpec.DhcpConfigurationEnabled = # Boolean # $iIPSpec.Address = # [string] # $iIPSpec.SubnetMask = # [string] # $iIPSpec.DefaultGateway = # [string] # $iIPSpec.PrimaryDnsServerAddress = # [string] # $iIPSpec.AlternateDnsServerAddress = # [string] # $iIPSpec.Mac = # [string] # $StorageSystem.UpdateInternetScsiIPProperties( $HbaName, $iIPSpec ) # ------------------------------------------------------------------- # Authentication Properties # Uncomment and set values as needed if using CHAP # ------------------------------------------------------------------- # $iAuthSpec = New-Object VMware.Vim.HostInternetScsiHbaAuthenticationProperties # $iAuthSpec.ChapAuthEnabled = # Boolean # $iAuthSpec.ChapName = # [string] # $iAuthSpec.ChapSecret = # [string] # $StorageSystem.UpdateInternetScsiAuthenticationProperties( $HbaName, $iAuthSpec ) # ------------------------------------------------------------------- # Discovery Properties # Uncomment and set values as needed # ------------------------------------------------------------------- # $iDiscoSpec = New-Object vmware.Vim.HostInternetScsiHbaDiscoveryProperties # $iDiscoSpec.ISnsDiscoveryEnabled = # Boolean ## SNS Discovery Methods: isnsDhcp, isnsSlp, isnsStatic # $iDiscoSpec.ISnsDiscoveryMethod = # [string] # $iDiscoSpec.ISnsHost = # [string] # $iDiscoSpec.SlpDiscoveryEnabled = # Boolean ## SLP Discovery Methods: slpAutoMulticast, slpAutoUnicast, slpDhcp, slpManual # $iDiscoSpec.SlpDiscoveryMethod = [string] # $iDiscoSpec.SlpHost = # [string] # $iDiscoSpec.StaticTargetDiscoveryEnabled = # Boolean # $iDiscoSpec.SendTargetsDiscoveryEnabled = # Boolean # $StorageSystem.UpdateInternetScsiDiscoveryProperties( $HbaName, $iDiscoSpec ) # ------------------------------------------------------------------- # Static Targets # If using static targets, you can specify them here. Note that the # add method will accept an array of targets. Copy and paste to create # as many targets as needed and add the names to the $staticTargets array. # ------------------------------------------------------------------- # $iStaticTarget1 = New-Object VMware.Vim.HostInternetScsiHbaStaticTarget # $iStaticTarget1.Address = # [string] # $iStaticTarget1.IScsiName = # [string] # $iStaticTarget1.Port = 3260 # [int] # $staticTargets = $iStaticTarget1, $iStaticTarget2, $iStaticTarget3 # $StorageSystem.AddInternetScsiStaticTargets( $HbaName, $staticTargets ) # ------------------------------------------------------------------- # Send Targets # If using send targets, you can specify them here. Note that the # add method will accept an array of targets. Copy and paste to create # as many targets as needed and add the names to the $sendTargets array. # ------------------------------------------------------------------- # $iSendTarget1 = New-Object VMware.Vim.HostInternetScsiHbaSendTarget # $iSendTarget1.Address = # [string] # $iSendTarget1.Port = 3260 # [int] # $sendTargets = $iSendTarget1, $iSendTarget2, $iSendTarget3 # $StorageSystem.AddInternetScsiSendTargets( $HbaName, $sendTargets ) # After configuration is complete, this will allow the new LUNs and datastores to be seen Get-VMHostStorage -VMHost $VMHostName -RescanAllHba -RescanVmfs