Configuration manager - New-CMProgram

Hello guys,

Hope you can direct me to a good place, cause i am pretty lost.

I have Configuration manager current branch.
I created a package and a program with powershell and i need to choose specific platforms in the program.

New-CMPackage -Name 7zip_v4.65 -Version 4.65 -Path "\\server1\packages\7zip_v.65"
New-CMProgram -CommandLine "7zip.exe /s" -PackageName "7zip_v4.65" -StandardProgramName "7zip_install"

For instance: All windows 7 x64 and All windows 7 x86

One of the New-CMProgram parameters is:
[-AddSupportedOperatingSystemPlatform ] IResultObject
and i don’t know what IResultObject means :frowning:

i have tried to do the following in order to understands how powershell saves this kind of information:

$pkg = Get-CMProgram -PackageName "7zip_v4.75" -ProgramName "7zip_install"

And this is what is got:

PS AMR:\> $pkg.SupportedOperatingSystems
SmsProviderObjectPath : SMS_OS_Details
MaxVersion            : 6.10.9999.9999
MinVersion            : 6.10.0000.0
Name                  : Win NT
Platform              : x64

SmsProviderObjectPath : SMS_OS_Details
MaxVersion            : 6.10.9999.9999
MinVersion            : 6.10.0000.0
Name                  : Win NT
Platform              : I386

What can i do with this info?

Thank you so much for helping.
Amir

The IResultObject is looking for an object of a specific class. In this case, SMS_SupportedPlatform, which is different from the SMS_OS_Details that returns with your $pkg.SupportedOperatingSystems.

To find the SMS_SupportedPlatform, use Get-CMSupportedPlatform. This will list all available platforms, and you will need to find the one you need and either use it like a parameter -AddSupportedOperatingSystemPlatform (Get-CMSupportedPlatform -Name “xxxxx”) or store it in variable, then use that variable inline.

Thank you so much for helping.
I will take it from here and see what can i do with the new info you provided.

Have a nice day :slight_smile:

Amir