sync
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
$Datacenters = Get-Datacenter -Name Primary*, Secondary*
|
||||
ForEach ($Datacenter in $Datacenters) {
|
||||
write-warning -Message $Datacenter.name
|
||||
$DatacenterName = $Datacenter.Name
|
||||
$Datastores = $Datacenter | Get-Datastore -Name *FS92*
|
||||
|
||||
$result = [System.Collections.ArrayList]@()
|
||||
ForEach ($Datastore in $Datastores) {
|
||||
write-warning -Message $Datastore.name
|
||||
$VMsOnDatastore = $null
|
||||
|
||||
$VMsOnDatastore = $Datastore | Get-VM
|
||||
$VMDKsOnDatastore = $VMsOnDatastore | Get-HardDisk | Where-Object Filename -Match $Datastore.Name
|
||||
|
||||
|
||||
$obj = [PSCustomObject]@{
|
||||
'DatastoreName' = $Datastore.Name;
|
||||
'UsedSpaceGB' = [math]::round($Datastore.CapacityGB - $Datastore.FreeSpaceGB, 2);
|
||||
#'FreeSpaceGB' = [math]::round($Datastore.FreeSpaceGB, 2);
|
||||
'CapacityGB' = [math]::round($Datastore.CapacityGB, 2);
|
||||
'PercentUsed' = [math]::round(($Datastore.CapacityGB - $Datastore.FreeSpaceGB) / $Datastore.CapacityGB, 2);
|
||||
#'VMUsedSpaceGB' = [math]::round(($VMsOnDatastore | Measure-Object -Sum UsedSpaceGB).Sum, 2);
|
||||
#'VMProvisionedGB' = [math]::round(($VMsOnDatastore | Measure-Object -Sum ProvisionedSpaceGB).Sum, 2);
|
||||
#'VMPercentUsed' = [math]::round(($VMsOnDatastore | Measure-Object -Sum UsedSpaceGB).Sum / ($VMsOnDatastore | Measure-Object -Sum ProvisionedSpaceGB).Sum , 2);
|
||||
}
|
||||
|
||||
$null = $result.Add($obj)
|
||||
}
|
||||
$Date = Get-Date -UFormat %Y%m%d
|
||||
$result | Export-Csv -Path "D:\State of North Dakota\-Tm-ITD-Virtualization - Documents\FS9200 Overprovision Fixes\FS9200-$DatacenterName-$Date.csv"
|
||||
}
|
||||
Reference in New Issue
Block a user