Hi, @Shreedhar Ghare
Thank you for posting in Microsoft Q&A forum.
To read lazy properties from a Configuration Manager object returned in a query, you need to get the object instance, which in turn retrieves any lazy object properties from the SMS Provider.
In the PowerShell script provided, you are using the Invoke-RestMethod cmdlet to retrieve the SMS_Program class, but it is not returning the value for the SupportedOperatingSystems property.
To access lazy properties in PowerShell, you can use the Get-WmiObject cmdlet with the -Property parameter to specify the lazy property you want to retrieve. Here is an example of how you can modify your PowerShell script to retrieve the SupportedOperatingSystems lazy property:
$uri = "https://Localhost.Ghare/AdminServices/wmi/SMS_Program"
$program = Invoke-RestMethod -Uri $uri -UseDefaultCredentials
$programInstance = Get-WmiObject -Namespace $program.NamespacePath -Class $program.ClassName -Filter "LocalizedDisplayName='$($program.LocalizedDisplayName)'" -ComputerName $program.MachineName -Impersonation 3 -Authentication 6 -Property SupportedOperatingSystems
$programInstance.SupportedOperatingSystems
This script retrieves the SMS_Program class using the Invoke-RestMethod cmdlet and then uses the Get-WmiObject cmdlet to retrieve the SMS_Program instance and the SupportedOperatingSystems lazy property.
The -Namespace parameter specifies the namespace of the class, the -Class parameter specifies the name of the class, the -Filter parameter specifies the filter to apply to the class, and the -Property parameter specifies the lazy property to retrieve.
The script then outputs the value of the SupportedOperatingSystems property.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Add comment".