VMware Cloud Community
oppemarc
Contributor
Contributor

Rescan HBA if specific Datastore is not availiable

Hello guys,

I need help to create a powercli script that checks if a specific Datastore is availiable and if not rescan´s the HBA.

Thanks

0 Kudos
1 Reply
LucD
Leadership
Leadership

Is this what you want to do ?

$tgtDatastoreName = "DS1" 
$esxName
= "MyESX"
if
(!(Get-Datastore -Name $tgtDatastoreName -VMHost $esxName -ErrorAction SilentlyContinue)){     Get-VMHostStorage -VMHost $esxName -RescanAllHba
}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos