Skip to content
Script to Edit SCCM Program Setting Under Requirement Tab ConfigMgr

Script to Edit SCCM Program Setting Under Requirement Tab ConfigMgr

Written By Anoop C Nair
Last Updated August 7, 2024
Posted In SCCM
SHARE

Script to Edit SCCM Program Setting Under Requirement Tab ConfigMgr. I have seen the people requesting the script to change This program can run only on specified client platforms option in the program properties.

In this scenario, we are looking to migrate all the machines to Windows 7 and all the packages already created with the requirement to install them on the XP environment platform only.

We can edit the program setting under the requirement tab to make it possible to run on Windows 7, but there are ways to automate it.

In this blog post, we will learn about Script to Edit SCCM Program Setting Under Requirement Tab ConfigMgr.

Patch My PC

Script to Edit SCCM Program Setting Under Requirement Tab ConfigMgr

There is a script that I have seen that can read a package list from a text file and add a platform like “Windows 7”.

Script to Edit SCCM Program Setting Under Requirement Tab ConfigMgr
Script to Edit SCCM Program Setting Under Requirement Tab ConfigMgr – Fig.1

Copy the below script – Script to Edit SCCM Program Setting Under Requirement Tab ConfigMgr

 ' Run the query to get the package.
  Set package = connection.Get(packageQuery)
 
  ' Output package name and ID.
  wscript.echo "Package ID:   " & package.PackageID
  wscript.echo "Package Name:  " & package.Name
 
  ' Build a query to get the programs for the package.
  programQuery = "SELECT * FROM SMS_Program WHERE PackageID='" & existingPackageID & "'"
 
  ' Run the query to get the programs.
  Set allProgramsForPackage = connection.ExecQuery(programQuery, , wbemFlagForwardOnly Or wbemFlagReturnImmediately)
  'The query returns a collection of program objects that needs to be enumerated.
  For Each program In allProgramsForPackage       
    If program.ProgramName = existingProgramName Then
      'Get all program object properties (in this case we specifically need some lazy properties).
       programPath = program.Put_
       Set program = connection.Get(programPath)
       ' Check whether RUN_ON_SPECIFIED_PLATFORMS is already set.
       checkPlatformValue = (program.ProgramFlags XOR RUN_ON_SPECIFIED_PLATFORMS)
      If checkPlatformValue = 0 Then
        ' RUN_ON_SPECIFIED_PLATFORMS is not set. Setting RUN_ON_SPECIFIED_PLATFORMS value.
        program.ProgramFlags = (program.ProgramFlags XOR RUN_ON_SPECIFIED_PLATFORMS)
      End If          
            
      ' Output the program name that is being checked for supported platforms.
      wscript.echo "Program Name: " & program.ProgramName
     
      ' Create
      Set tempSupportedPlatform = connection.Get("SMS_OS_Details").SpawnInstance_
          
      ' Populate tempSupportedPlatform values. 
      tempSupportedPlatform.MaxVersion = newMaxVersion
      tempSupportedPlatform.MinVersion = newMinVersion
      tempSupportedPlatform.Name    = newName
      tempSupportedPlatform.Platform  = newPlatform
 
      ' Get the array of supported operating systems.
      tempSupportedPlatformsArray = program.SupportedOperatingSystems 
     
      ' Add the new supported platform values (object) to the temporary array.
      'ReDim Preserve tempSupportedPlatformsArray (Ubound(tempSupportedPlatformsArray) + 1)
      'Loop to search All X86 Windows XP'
      For i=0 to Ubound(tempSupportedPlatformsArray)
      If ((tempSupportedPlatformsArray(i).MinVersion = "5.10.0000.0") AND (tempSupportedPlatformsArray(i).MaxVersion = "5.10.9999.9999")AND (tempSupportedPlatformsArray(i).Platform = "I386"))Then
      'If platform is All X86 Windows XP replace by Windows XP SP2'
       Set tempSupportedPlatformsArray(i) = tempSupportedPlatform
      Else
        wscript.echo tempSupportedPlatformsArray(i).Platform
      End If
      Next
      ' Replace the SupportedOperatingSystems object array with the new updated array.
      program.SupportedOperatingSystems = tempSupportedPlatformsArray
      ' Save the program.
      program.Put_
      ' Output success message.
      wscript.echo "Supported Platforms Updated "
    End If   
  Next
End Sub

P.S – Test the script in the LAB environment before applying it on PRODUCTION.

References –SDK SMS_OS_Details server WMI Class and Technet Thread.

Script to Edit SCCM Program Setting Under Requirement Tab ConfigMgr

We are on WhatsApp. To get the latest step-by-step guides and news updates, Join our Channel. Click here –HTMD WhatsApp.

Author

Anoop C Nair is Microsoft MVP! He is a Device Management Admin with more than 20 years of experience (calculation done in 2021) in IT. He is a Blogger, Speaker, and Local User Group HTMD Community leader. His primary focus is Device Management technologies like SCCM 2012, Current Branch, and Intune. He writes about ConfigMgr, Windows 11, Windows 10, Azure AD, Microsoft Intune, Windows 365, AVD, etc.

Written by

Anoop C Nair is Workplace Technology solution architect with 25+ years of experience in global enterprise organizations such as JP Morgan, Capgemini, etc. Microsoft Certified Trainer. Microsoft MVP from 2015 onwards for consecutive 11+ years! He also conducts Intune and modern workplace tech training for enterprise organizations. He is Blogger, Speaker, and Founder of HTMD Community and HTMD Conference. His main focus is on Device Management technologies like Intune, Windows, Cloud PC. He writes about technologies like Intune, SCCM, Windows, Cloud PC, Windows, Entra, Microsoft Security.

Discussion · 3 comments

  1. Hi thanks for posting this. I was looking for a script to enable my programs to run on Windows 10 x64, for the ones that have Windows 7 x64 enabled already. Wanted to enable the checkbox under the Requirements tab. Would I update this section as the below?:
    tempSupportedPlatform.MaxVersion = “10.00.99999.9999”
    tempSupportedPlatform.MinVersion = “10.00.0000.0”
    tempSupportedPlatform.Name = “Win NT”
    tempSupportedPlatform.Platform = “x64”
    ‘ Get the array of supported operating systems.
    tempSupportedPlatformsArray = program.SupportedOperatingSystems

    ‘ Add the new supported platform values (object) to the temporary array.
    ‘ReDim Preserve tempSupportedPlatformsArray (Ubound(tempSupportedPlatformsArray) + 1)
    ‘Loop to search All X86 Windows XP’
    For i=0 to Ubound(tempSupportedPlatformsArray)
    If ((tempSupportedPlatformsArray(i).MinVersion = “6.10.0000.0”) AND (tempSupportedPlatformsArray(i).MaxVersion = “6.10.9999.9999”)AND (tempSupportedPlatformsArray(i).Platform = “x64”))Then

Join the discussion

Your email address will not be published. Required fields are marked *

Related guides

Intune

Windows 11 KB5101650 KB5099414 July 2026 Patch and 3 Zero Day Vulnerabilities and 570 Flaws

Key Takeaways Windows 11 KB5101650 KB5099414 July 2026 Patch and 3 Zero Day Vulnerabilities and 570 Flaws! In the July 2026 Patch, Microsoft introduced new features designed to improve the overall Windows experience. The update adds enhancements to Windows Update for more flexible update management and introduces Point-in-Time Restore, providing an additional recovery option for […]

AC Anoop C Nair 9 min read
Intune

2026 June KB5094126 KB5093998 Windows 11 Patch | 3 Zero Day Vulnerabilities and 200 Flaws

Key Takeaways 2026 June KB5094126 KB5093998 Windows 11 Patch | 3 Zero Day Vulnerabilities and 200 Flaws! The June 2026 Windows 11 Patch Tuesday update brings several improvements to File Explorer. It adds support for additional archive formats, including UU, CPIO, XAR, and NuGet Packages (NUPKG). The update also preserves View and Sort preferences in […]

AC Anoop C Nair 10 min read
Intune

2026 May KB5089549 KB5087420 Windows 11 Patch | 0 Zero Day Vulnerabilities and 120 Flaws

Key Takeaways The Windows 11 May 2026 Patch KB5089549 KB5087420 Update brings important security fixes, performance improvements, and reliability enhancements across the operating system. The update introduces new features such as Xbox Mode for gaming, File Explorer improvements, enhanced input and sharing experiences, better taskbar and Windows Hello reliability, and additional enterprise management capabilities for […]

AC Anoop C Nair 8 min read
SCCM

ConfigMgr 2603 Introduces New Early Update Enrollment Process

Key Takeaways In this post we are discussing the ConfigMgr 2603 Introduces New Early Update Enrollment Process. Microsoft has officially released Configuration Manager version 2603 to the Early Update Ring, giving organizations an opportunity to test upcoming improvements before the global production rollout. The release is targeted at enterprises running ConfigMgr version 2409 or later […]

AC Anoop C Nair 3 min read