Solved

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

Posted on 2015-02-10
5
201 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
  • 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Virtualize old XP PC 8 55
Gotten a bit confused with my rather simple PowerShell script 3 29
Awk : two files math 8 20
security id structure is invalid 2 24
HOW TO: Upload an ISO image to a VMware datastore for use with VMware vSphere Hypervisor 6.5 (ESXi 6.5) using the vSphere Host Client, and checking its MD5 checksum signature is correct.  It's a good idea to compare checksums, because many installat…
Giving access to ESXi shell console is always an issue for IT departments to other Teams, or Projects. We need to find a way so that teams can use ESXTOP for their POCs, or tests without giving them the access to ESXi host shell console with a root …
This video shows you how easy it is to boot from ISO images for virtual machines with the ISO images stored on a local datastore on the ESXi host.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

861 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