Refresh Datastores with PowerShell (oneliner)
As I mentioned in the previous article about Refreshing Datastores I would see if I could make a oneliner for this action and I succeed in doing that.
This is what the line should be:
Get-Datacenter | Get-Cluster -Name "ClusterName" | Get-VMHost | ForEach { $_ } { Get-VMHostStorage -VMHost:$_ -Refresh }
The result on the PowerCLI would probably look like this:
The ‘Recent Tasks’ window in the vSphere client will show you a line with “Refresh Host Storage System” for each server.
Thanks for Arne Fokkema for helping me out with the start of the oneliner
Cheers!
NOTE: Get-Datacenter isn’t really required so the oneliner can actually be shorter
No comments yet.