How can I refresh storage devices on ESXi host using PowerCLI ?
You could use the Get-VMHostStorage cmdlet, but that does more than just refresh.
It also returns the storage information.
To only do a Refresh, you could do
$esxName = 'MyEsx'
$esx = Get-VMHost -Name $esxName
$storSys = Get-view -Id $esx.ExtensionData.ConfigManager.StorageSystem
$storSys.RefreshStorageSystem()
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
You can use this command:
Get-VmHostStorage -VMHost < Specifiy the host > -Refresh
For Example:
Get-VmHostStorage -VMHost 10.23.112.234 -Refresh
Retrieves storage information from the virtual machine host with IP address 10.23.112.234.
You could use the Get-VMHostStorage cmdlet, but that does more than just refresh.
It also returns the storage information.
To only do a Refresh, you could do
$esxName = 'MyEsx'
$esx = Get-VMHost -Name $esxName
$storSys = Get-view -Id $esx.ExtensionData.ConfigManager.StorageSystem
$storSys.RefreshStorageSystem()
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thank you very much. 🙂