Solved

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

Posted on 2015-02-10
5
204 Views
Last Modified: 2015-02-10
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
Comment
Question by:REIUSA
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 5

Accepted Solution

by:
GG VP earned 500 total points
ID: 40600603
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
 

Author Comment

by:REIUSA
ID: 40601542
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
 

Author Comment

by:REIUSA
ID: 40601590
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
 

Author Comment

by:REIUSA
ID: 40601632
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
 
LVL 5

Expert Comment

by:GG VP
ID: 40602503
Glad to see your issue resolved and thanks for posting back, this will help others looking for a similar solution!
0

Featured Post

Flexible connectivity for any environment

The KE6900 series can extend and deploy computers with high definition displays across multiple stations in a variety of applications that suit any environment. Expand computer use to stations across multiple rooms with dynamic access.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article we will learn how to backup a VMware farm using Nakivo Backup & Replication. In this tutorial we will install the software on a Windows 2012 R2 Server.
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
The viewer will learn how to count occurrences of each item in an array.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question