Hi
How can i check if one datastore is "disk over commit" ? It is possible to obtain the size in GB or MB disk allocation?
I need to do this by powercli command.
Thks.
Ricardo Marques
You can try something like this
Get-View -ViewType Datastore | Select Name, @{N="CapacityGB";E={$_.Summary.Capacity/1GB}}, @{N="ProvisionedGb";E={($_.Summary.Capacity - $_.Summary.FreeSpace + $_.Summary.Uncommitted)/1GB}}, @{N="FreeGB";E={$_.Summary.FreeSpace/1GB}}
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
You can try something like this
Get-View -ViewType Datastore | Select Name, @{N="CapacityGB";E={$_.Summary.Capacity/1GB}}, @{N="ProvisionedGb";E={($_.Summary.Capacity - $_.Summary.FreeSpace + $_.Summary.Uncommitted)/1GB}}, @{N="FreeGB";E={$_.Summary.FreeSpace/1GB}}
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
And if you're running PowerCLI 4.1, you can do
New-VIProperty -Name ProvisionedGB -ObjectType Datastore -Value { param($ds) [Math]::Round(($ds.ExtensionData.Summary.Capacity - $ds.ExtensionData.FreeSpace + $ds.ExtensionData.Summary.Uncommitted)/1GB,1) } -BasedONextensionProperty 'Summary' -Force New-VIProperty -Name CapacityGB -ObjectType Datastore -Value { param($ds) [Math]::Round($ds.CapacityMB/1KB,1) } -Force New-VIProperty -Name FreeGB -ObjectType Datastore -Value { param($ds) [Math]::Round($ds.FreeSpaceMb/1KB,1) } -Force Get-Datastore | Select Name,CapacityGB,FreeGB,ProvisionedGB
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi
Yes i have the last version of powercli installed. When i run the last code i have the following error:
The term 'New-VIProperty' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At :line:4 char:14
+ New-VIProperty <<<< -Name ProvisionedGB -ObjectType Datastore -Value {
The first code works fine.
Thks.
Ricardo Marques
Do a
Get-PowerCLIVersion
I'm pretty sure it won't say 4.1.
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I have the following version installed:
PowerCLI Version
-
VMware vSphere PowerCLI 4.0 U1 build 208462
That's not the latest version.
You cna get PowerCLI 4.1 here.
But be aware that there is an issue with some of PowerGui's PowerPacks and EcoShell and PowerCLI 4.1.
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I do have the latest (PowerCLI 4.1 U1 Build 332441) and this script does execute without errors. The problem is that it returns all zeroes for capacityGB, FreeGB and ProvisionedGB.
This is the first script I have found that returns usable data in my environment (posted by LucD):
Get-View -ViewType Datastore | Select Name,
>> @{N="CapacityGB";E={$_.Summary.Capacity/1GB}},
>> @{N="ProvisionedGb";E={($_.Summary.Capacity - $_.Summary.FreeSpace + $_.
Summary.Uncommitted)/1GB}},
>> @{N="FreeGB";E={$_.Summary.FreeSpace/1GB}}
I assume that
Get-View -ViewType Datastore
on it's own returns the datastores ?
And what does this show
Get-View -ViewType Datastore | Select -ExpandProperty Summary
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
"Get-View - ViewType Datastore" spits out about 5000 lines of useless data. Accurate, but needlessly verbose.
"Get-View -ViewType Datastore | Select -ExpandProperty Summary" Produces the following error multiple times:
Select-Object : Cannot expand property "Summary" because it has nothing to expand.
At line:1 char:38
Again, your first script that I cited in my post is the only one I've found that actually works for me.