I have a report that shows all datastores in a DC and shows what percent is running on that datastore so I can check the load and keep it balanced manually if needed, but I added a cold storage datastore and it’s showing up in this report, what is the best way to remove it:
##################
# Variables #
###################
$date=Get-Date -format “yyyy-MMM-d”
$datetime=Get-Date
$filelocation=”varwwwNAS-LoadsVDC-NAS-LoadVDC-NAS-Load-$date.htm”
#############################
# Add Text to the HTML file #
#############################
$Header = @”
<style>
TABLE {border-width: 1px; border-style: solid; border-color: black; border-collapse: collapse;}
TH {border-width: 1px; padding: 3px; border-style: solid; border-color: black; background-color: #6495ED;}
TD {border-width: 1px; padding: 3px; border-style: solid; border-color: black;}
</style>
“@
$dcName = ‘VDC’
$ds = Get-Datacenter -Name $dcName | Get-Datastore |
where {$_.Type -eq ‘VMFS’ -and $_.ExtensionData.Summary.MultipleHostAccess}
$totalSpaceUsed = $ds | % {$_.CapacityGB – $_.FreeSpaceGB} | Measure-Object -Sum | select -ExpandProperty Sum
Get-Stat -Entity $ds -Stat ‘disk.used.latest’ -Realtime -MaxSamples 1 -Instance ” |
ForEach-Object -Process {
New-Object PSObject -Property @{
Datastore = $_.Entity.Name
PercentofTotalSpaceGB = [math]::Round(($_.Value / 1MB) / $totalSpaceUsed * 100, 1)
}
} |
Sort-Object -Property Datastore |
Select Datastore, PercentofTotalSpaceGB |
ConvertTo-Html -Head $Header |
Out-File $filelocation
Invoke-Item -Path .report.html