Hi,
I use get-datastore to generate a report of datastore free space. I noticed that the free space reported matches to whatever value that is presented on VI Client Datastore View. However, that view is not accurate and a refresh is required to get an updated free space.
How can do refresh the free space value?
You could use the SDK RefreshDatastore method.
foreach($ds in (Get-Datastore | Get-View)){ $ds.RefreshDatastore() }
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
You could use the SDK RefreshDatastore method.
foreach($ds in (Get-Datastore | Get-View)){ $ds.RefreshDatastore() }
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Cool, it works. Cheers!
I have 75 datastores and if i call the refreshDatastore() method every time i am getting free space, i have to do this 75 times - one for each datastore? This ends up slowing down vCenter and ultimately, even connections to vCenter fail for a while. Is there any other alternative? Please help.
R.
In PowerCLI 4.0 U1 we introduced Get-Datastore -Refresh, you might try it to see if it works any better.
If not, it is a vCenter limitation.
=====
Carter Shanklin
Read the PowerCLI Blog
[Follow me on Twitter|http://twitter.com/cshanklin]
The new Get-Datastore -Refresh is considerable faster then the original RefreshDatastore script.
But the fastest method I could find is a script that use Get-View and RefreshDatastore
Get-View -ViewType Datastore -SearchRoot (Get-Datacenter <dcname> | Get-View).MoRef | %{$_.RefreshDatastore()}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi,
I am also facing the same problem.Can u provide the corresponding method in vi sdk for Get-Datastore-Refresh and Get-View +RefreshDatastore.
Thanks in advance
karthika
The underlying SDK method for both ways is what I showed in my first answer in this thread.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi ,
I am also using the same method what u mentioned in first reply.It is taking more time to refresh the datastore.Is there any way to reduce the time taken using VI SDK?
FYI:
foreach($ds in (Get-Datastore | Get-View)){ $ds.RefreshDatastore() }
Regards,
karthika