[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 214
  • Last Modified:

Script or tool to gather Datastore Space info from multiple DC's and clusters?

Hello,
I need to figure out a way to script or use a tool to gather info and export to a spread sheet.

What I need is a way to look at the status of datastores, total size, used space, and free space. Over several datacenters in vsphere and several clusters per DC. The most important info I need is the cluster name, datastore name, and free space.

I recently started using RVTools and is seem great but I don't see a way to get the info I need so far. Preferably I would love to be able to run a script or tool one time to gather info on all the vsphere DC's.

Can someone help point me in the right direction?
0
REIUSA
Asked:
REIUSA
  • 3
  • 2
1 Solution
 
GG VPCommented:
You can use Vsphere Client, if that doesn't provide what you are looking for, then PowerCLI can be used to get the info,

Here is the one liner from the blog post,

http://www.vnoob.com/2013/07/quicktip-get-datastore-capacity-with-a-powercli-one-liner/

get-datastore | select-object name,@{Label=”FreespaceGB”;E={“{0:n2}” -f ($_.FreespaceGB)}}, CapacityGB, @{Label=”Provisioned”;E={“{0:n2}” -f ($_.CapacityGB – $_.FreespaceGB +($_.extensiondata.summary.uncommitted/1GB))}}|sort name

Open in new window


Please have a look at the following scripts too,

http://vsential.com/2010/09/datastore-size-reporting-via-powercli-script/

http://www.vmwarearena.com/2013/12/powershell-script-to-collect-datastore.html
0
 
REIUSAAuthor Commented:
Thanks, it looks like the second two links are working and I can generate a report. When I run the code at vsential that pretty much does what I need it to do but I need to add free space in addition to free %.

Any idea what the syntax would be to add actual free space to the CSV output?
0
 
REIUSAAuthor Commented:
I think I see where to make the change but I'm not sure what to put in place of ".ExtensionData.Summary.FreeSpace" to show the actual Free space. In this script the below syntax is what shows the UsedSpace.

@{N=”UsedSpaceGB”;E={[Math]::Round(($_.ExtensionData.Summary.Capacity – $_.ExtensionData.Summary.FreeSpace)/1GB,0)}}
0
 
REIUSAAuthor Commented:
Got it working now with the following syntax. I don't know if the Math in brackets is needed but I left it in and it worked. I didn't realize at first the other sections were subtracting one number from another.

@{N=”FreeSpaceGB”;E={[Math]::Round(($_.ExtensionData.Summary.FreeSpace)/1GB,0)}}

Thanks for your help.
0
 
GG VPCommented:
Glad to see your issue resolved and thanks for posting back, this will help others looking for a similar solution!
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now