From d06584bcd0aa5094e590bc324bedaaa2db515525 Mon Sep 17 00:00:00 2001 From: Zack Meier Date: Tue, 21 Apr 2026 16:37:10 -0500 Subject: [PATCH] update --- .../Scripts/Sync-ITDVMwareVMMetadataToSql.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 ac8767f..32c5a28 100644 --- a/_NDGOV_WindowsTeam/ITD.Infra-VMware.Administration/Scripts/Sync-ITDVMwareVMMetadataToSql.ps1 +++ b/_NDGOV_WindowsTeam/ITD.Infra-VMware.Administration/Scripts/Sync-ITDVMwareVMMetadataToSql.ps1 @@ -119,13 +119,13 @@ Write-Verbose "Gathering VMs" # Include ALL VMs (SRM placeholders flagged via column, not excluded). # vCLS agent VMs are excluded -- they are vSphere internal and not customer workloads. -$AllVMs = Get-VM | Where-Object { $_.Name -notlike 'vCLS*' } | Sort-Object -Property Name +$AllVMs = Get-VM | Where-Object { $_.Name -notlike 'vCLS*' } #--- Pre-fetch all tag assignments in one API call (avoids per-VM Get-TagAssignment) Write-Verbose 'Pre-fetching VM tag assignments...' $TagLookup = @{} Get-TagAssignment -Entity $AllVMs | ForEach-Object { - $VMId = $_.Entity.Id + $VMId = $_.Entity.Uid $Cat = $_.Tag.Category.Name $TagName = $_.Tag.Name if (-not $TagLookup.ContainsKey($VMId)) { $TagLookup[$VMId] = @{} } @@ -153,7 +153,7 @@ $Results = foreach ($VM in $AllVMs) { $DatacenterName = $HostDatacenterMap[$VM.VMHost.Name] #--- Tag assignments (pre-fetched; null when category not assigned to this VM) - $VMTags = if ($TagLookup.ContainsKey($VM.Id)) { $TagLookup[$VM.Id] } else { @{} } + $VMTags = if ($TagLookup.ContainsKey($VM.Uid)) { $TagLookup[$VM.Uid] } else { @{} } #--- Storage platform parsed from datastore name convention: VMCLUSTER_LUN_PLATFORM_Desc # Segment 2 = storage platform identifier (e.g. FS92, A9K).