This commit is contained in:
Zack Meier
2026-05-07 15:49:59 -05:00
parent 16427a9930
commit 4602a16623
2 changed files with 48 additions and 11 deletions
@@ -213,7 +213,7 @@ $Results = foreach ($VM in $AllVMs) {
# --- vCenter Tags
Tag_DRProtection = $VMTags['DR Protection']
Tag_AppName = $VMTags['AppName']
Tag_AppName = if ($null -ne $VMTags['AppName']) { $VMTags['AppName'] } else { 'N/A' }
Tag_VRDatastores = $VMTags['VR Datastores']
Tag_VRRPO = $VMTags['VR RPO']
Tag_DTAP = $VMTags['DTAP']
@@ -223,6 +223,42 @@ $Results = foreach ($VM in $AllVMs) {
}
}
#region --- Back-fill SRM placeholder fields from real VM ----------------------
# SRM placeholder VMs share the same name as their real counterpart but lack
# guest-level data. For the fields below, substitute the real VM's values so
# placeholders carry useful metadata for reporting.
$RealVMLookup = @{}
foreach ($R in $Results) {
if (-not $R.IsSRMPlaceholder) { $RealVMLookup[$R.VMName] = $R }
}
$PlaceholderFieldsToFix = @(
'GuestOS'
'ProvisionedSpaceGB'
'UsedSpaceGB'
'GuestDiskCapacityGB'
'GuestDiskUsedGB'
'ToolsVersionStatus'
'Tag_DRProtection'
'Tag_AppName'
'Tag_VRDatastores'
'Tag_VRRPO'
'Tag_DTAP'
'Tag_StartupPriority'
'Tag_SRMRecoveryType'
'Tag_LicensingRestrictions'
)
foreach ($R in $Results) {
if ($R.IsSRMPlaceholder -and $RealVMLookup.ContainsKey($R.VMName)) {
$Real = $RealVMLookup[$R.VMName]
foreach ($Field in $PlaceholderFieldsToFix) { $R.$Field = $Real.$Field }
}
}
#endregion
#endregion
<#region --- Export CSV ---------------------------------------------------------