Skip to content

Instantly share code, notes, and snippets.

@timconradinc
Created May 30, 2012 15:12
Show Gist options
  • Save timconradinc/2836910 to your computer and use it in GitHub Desktop.
Save timconradinc/2836910 to your computer and use it in GitHub Desktop.
Connect to vcenter, get list of datastores
Connect-VIServer -Server vcenter.example.com -User someuser
$output = "c:\datastores.csv"
$report = @()
foreach ($ds in Get-Datastore) {
$row = "" | Select Name, FreeSpaceMB, CapacityMB
$row.FreeSpaceMB = $ds.FreeSpaceMB
$row.Name = $ds.Name
$row.CapacityMB = $ds.CapacityMB
$report += $row
}
$report | Export-Csv $output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment