As new OS platforms are rolled out from Microsoft, SCCM administrators need to make sure that their legacy software is not targeted to one of these new platforms. Instead of modifying each collection to exclude the new operating system, you can configure the supported platform property on the program that is targeted to those collections.
Here’s some sample code that I’m using to change programs supported platforms from ANY operating system to only run on x86 Windows XP.
#Creating the path to the object
$ProgramPath = “\\$strCentralSiteServer\root\sms\site_”+$strCentralSiteCode+”:SMS_Program.PackageID=’$strPackageID’,ProgramName=’$ProgramName’”
#Grabbing the program object
$program = [WMI]$ProgramPath
#If the “ANY Platform” flag is set, change it to “specified platforms”
if (($program.ProgramFlags -band [MATH]::Pow(2,27)) -ne 0)
$program.ProgramFlags = $program.ProgramFlags – ([MATH]::Pow(2,27))
#Creating an OS Details instance to add to the lazy properties for the supported platforms array.
$TempSupportedPlatform = ([WmiClass](“\\$strCentralSiteServer\root\sms\site_”+$strCentralSiteCode+”:SMS_OS_Details”)).CreateInstance()
#Populate tempSupportedPlatform values.
$tempSupportedPlatform.MaxVersion = “5.10.9999.9999″
$tempSupportedPlatform.MinVersion = “5.10.0000.0″
$tempSupportedPlatform.Name = “Win NT”
$tempSupportedPlatform.Platform = “I386″
# Get the array of supported operating systems.
$tempSupportedPlatformsArray = $tempsupportedplatform
#Assigning the new platform to the programflags
$program.SupportedOperatingSystems = $tempSupportedPlatformsArray
#Adding the changes to the program