Last active
July 4, 2018 08:44
-
-
Save peterhynes/ecf0377305243c114ad50ab33625e928 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Script to get provisioned state for clusters in a vc by Peter Hynes | |
| #Needs vSphere overcommit module located at https://blogs.vmware.com/PowerCLI/2015/01/powercli-module-check-cpu-memory-storage-overcommitment.html | |
| #Script asks for a vcenter name | |
| $Vcenter = read-host "please enter the name of the vcenter you will be working in" | |
| #Connects to the vcenter | |
| Connect-viserver $Vcenter | |
| #get all clusters | |
| $allclusters = get-cluster | |
| $allDataStoresClusters = get-datastorecluster | |
| #loop through all clusters and get cpu details | |
| write-host "getting CPU details for all clusters" -foregroundcolor Yellow | |
| foreach($c in $allclusters){ | |
| write-host "working on cluster $c" -foregroundcolor Green | |
| Get-CPUOvercommit -cluster $c -ErrorAction SilentlyContinue | export-csv -Append -Path "CPU Details for $Vcenter.csv" -NoTypeInformation | |
| } | |
| #loop through all clusters and get Memory details | |
| write-host "getting Memory details for all clusters" -foregroundcolor Yellow | |
| foreach($c in $allclusters){ | |
| write-host "working on cluster $c" -foregroundcolor Green | |
| Get-MemoryOvercommit -cluster $c -ErrorAction SilentlyContinue | export-csv -Append -Path "Memory Details for $Vcenter.csv" -NoTypeInformation | |
| } | |
| #loop through all datastore clusters and get Storage details | |
| write-host "getting Storage details for all clusters" -foregroundcolor Yellow | |
| foreach($dsc in $allDataStoresClusters){ | |
| write-host "working on cluster $dsc" -foregroundcolor Green | |
| Get-StorageOvercommit -cluster $dsc -ErrorAction SilentlyContinue | export-csv -Append -Path "Storage Details for $Vcenter.csv" -NoTypeInformation | |
| } | |
| write-host "Script complete" -foregroundcolor Yellow | |
| disconnect-viserver $Vcenter |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment