Add lazy property loading support to Get-CCMApplication function
This PR implements the ability to load lazy properties for CCM classes, starting with the Get-CCMApplication function.
Problem
Configuration Manager classes like CCM_Application use lazy-loaded properties such as AppDTs (deployment types) that are not populated in initial CIM queries. These properties contain important information but require additional queries to load, resulting in performance implications.
Solution
Added a new -IncludeLazyProperties switch parameter to Get-CCMApplication that enables lazy property loading when needed:
# Standard usage (no change in behavior)
Get-CCMApplication -ApplicationName "7-Zip"
# Load lazy properties including AppDTs (deployment types)
Get-CCMApplication -ApplicationName "7-Zip" -IncludeLazyProperties
# Works with filtering and remote computers
Get-CCMApplication -ApplicationID "ScopeId_12345" -ComputerName "RemotePC" -IncludeLazyProperties
Implementation Details
- When
-IncludeLazyPropertiesis specified, the function performs a second, more specific CIM query for each application using itsIdandRevisionas filters - This secondary query loads the lazy properties like
AppDTsthat are normally null/empty - Includes comprehensive error handling with warnings if lazy property loading fails for individual applications
- Works with all connection types: CimSession, PSSession, and direct computer name
- Feature is disabled by default to maintain current performance characteristics
Backward Compatibility
- Maintains full backward compatibility - existing scripts continue to work unchanged
- No performance impact when the switch is not used
- All existing parameters and functionality remain intact
Performance Considerations
The feature significantly increases network activity as each application requires an additional CIM query. This is why it's disabled by default and should only be used when lazy properties are specifically needed.
Fixes #47.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.