From c63525d609157e8e0b7da259ccd6446e55b966fd Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 28 Aug 2025 13:44:54 +0000 Subject: [PATCH 1/3] Initial plan From cc5b2146267369eb91496a100f47a6841686dd16 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 28 Aug 2025 13:51:29 +0000 Subject: [PATCH 2/3] Add -IncludeLazyProperties switch to Get-CCMApplication function Co-authored-by: CodyMathis123 <28543620+CodyMathis123@users.noreply.github.com> --- NUL | 0 Source/Public/Get-CCMApplication.ps1 | 30 +++++++++++++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 NUL diff --git a/NUL b/NUL new file mode 100644 index 0000000..e69de29 diff --git a/Source/Public/Get-CCMApplication.ps1 b/Source/Public/Get-CCMApplication.ps1 index cfa967f..9b1181b 100644 --- a/Source/Public/Get-CCMApplication.ps1 +++ b/Source/Public/Get-CCMApplication.ps1 @@ -7,6 +7,8 @@ function Get-CCMApplication { [string[]]$ApplicationID, [Parameter(Mandatory = $false)] [switch]$IncludeIcon, + [Parameter(Mandatory = $false)] + [switch]$IncludeLazyProperties, [Parameter(Mandatory = $false, ValueFromPipelineByPropertyName = $true, ParameterSetName = 'CimSession')] [Microsoft.Management.Infrastructure.CimSession[]]$CimSession, [Parameter(Mandatory = $false, ValueFromPipelineByPropertyName = $true, ParameterSetName = 'ComputerName')] @@ -19,7 +21,7 @@ function Get-CCMApplication { [ValidateSet('CimSession', 'PSSession')] [string]$ConnectionPreference ) - # ENHANCE - Support lazy loading properties + # Lazy loading properties (like AppDTs) are supported via the -IncludeLazyProperties switch begin { #region define our hash tables for parameters to pass to Get-CIMInstance and our return hash table $getapplicationsplat = @{ @@ -118,6 +120,32 @@ function Get-CCMApplication { } switch ($null -ne $AppToReturn) { $true { + # Load lazy properties if requested + if ($IncludeLazyProperties.IsPresent) { + try { + # Re-query the specific application instance to load lazy properties + $lazyLoadSplat = @{ + NameSpace = 'root\CCM\ClientSDK' + ClassName = 'CCM_Application' + Filter = "Id='$($AppToReturn.Id)' AND Revision='$($AppToReturn.Revision)'" + } + [ciminstance]$AppWithLazyProps = switch ($Computer -eq $env:ComputerName) { + $true { + Get-CimInstance @lazyLoadSplat @connectionSplat + } + $false { + Get-CCMCimInstance @lazyLoadSplat @connectionSplat + } + } + if ($AppWithLazyProps) { + $AppToReturn = $AppWithLazyProps + } + } + catch { + Write-Warning "Failed to load lazy properties for application '$($AppToReturn.Name)': $($_.Exception.Message)" + } + } + $PropsToShow = 'Name', 'FullName', 'SoftwareVersion', 'Publisher', 'Description', 'Id', 'Revision', 'EvaluationState', 'ErrorCode', 'AllowedActions', 'ResolvedState', 'InstallState', 'ApplicabilityState', 'ConfigureState', 'LastEvalTime', 'LastInstallTime', From 958115a4b08c44bad66423f1dff58d2f1f2a39c4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 28 Aug 2025 13:55:14 +0000 Subject: [PATCH 3/3] Remove unwanted NUL file and finalize lazy properties implementation Co-authored-by: CodyMathis123 <28543620+CodyMathis123@users.noreply.github.com> --- NUL | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 NUL diff --git a/NUL b/NUL deleted file mode 100644 index e69de29..0000000