From 0cb505afbe962d0d5ea36b01c1af07f9ab8b9339 Mon Sep 17 00:00:00 2001 From: Zack Meier Date: Thu, 30 Apr 2026 15:37:20 -0500 Subject: [PATCH] update --- .../Scripts/Sync-ITDVMwareVMMetadataToSql.ps1 | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/_NDGOV_WindowsTeam/ITD.Infra-VMware.Administration/Scripts/Sync-ITDVMwareVMMetadataToSql.ps1 b/_NDGOV_WindowsTeam/ITD.Infra-VMware.Administration/Scripts/Sync-ITDVMwareVMMetadataToSql.ps1 index 32c5a28..a3464f5 100644 --- a/_NDGOV_WindowsTeam/ITD.Infra-VMware.Administration/Scripts/Sync-ITDVMwareVMMetadataToSql.ps1 +++ b/_NDGOV_WindowsTeam/ITD.Infra-VMware.Administration/Scripts/Sync-ITDVMwareVMMetadataToSql.ps1 @@ -222,6 +222,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 ---------------------------------------------------------