21 lines
918 B
PowerShell
21 lines
918 B
PowerShell
$Datastores = Get-Datastore *224*, *225*, *226*
|
|
$Folders = @()
|
|
ForEach ($Datastore in $Datastores) {
|
|
$DatastoreName = $Datastore.Name
|
|
$Folders += Get-ChildItem "vmstores:\itdvmvc2.nd.gov@443\Secondary Datacenter\$DatastoreName" | where-object { $_.ItemType -eq "Folder" -and $_.Name -ne '.dvsData' -and $_.Name -ne '.sdd.sf' -and $_.Name -ne '.vSphere-HA' }
|
|
}
|
|
|
|
$result = @()
|
|
ForEach ($Folder in $Folders) {
|
|
$obj = [PSCustomObject]@{
|
|
Datastore = $Folder.PSPath.split('\')[-2];
|
|
Folder = $Folder.Name;
|
|
SizeGB = [math]::Round(((Get-ChildItem -Path $Folder.FullName) | Measure-Object -Property Length -Sum).Sum / 1GB, 2);
|
|
}
|
|
$result += $obj
|
|
}
|
|
|
|
$VMs = Get-VM $Folders.Name | Where-Object { $_.ExtensionData.summary.config.ManagedBy.Type -ne "placeholderVm" } -ErrorAction SilentlyContinue | sort-object Name
|
|
Compare-Object $Folders.Name $VMs.Name | sort-object InputObject
|
|
|
|
F |