1- function New-IntuneWin32AppRequirementRule {
2- <#
3- . SYNOPSIS
4- Construct a new requirement rule as an optional requirement for Add-IntuneWin32App cmdlet.
5-
6- . DESCRIPTION
7- Construct a new requirement rule as an optional requirement for Add-IntuneWin32App cmdlet.
8-
9- . PARAMETER Architecture
10- Specify the architecture as a requirement for the Win32 app.
11- Supported values: x64, x86, arm64, x64x86, AllWithARM64.
12- - x64: 64-bit Intel/AMD processors only
13- - x86: 32-bit Intel/AMD processors only
14- - arm64: 64-bit ARM processors only
15- - x64x86: x64 and x86 (Intel/AMD architectures)
16- - AllWithARM64: x64, x86, and arm64 (universal)
17-
18- . PARAMETER MinimumSupportedWindowsRelease
19- Specify the minimum supported Windows release version as a requirement for the Win32 app.
20-
21- . PARAMETER MinimumFreeDiskSpaceInMB
22- Specify the minimum free disk space in MB as a requirement for the Win32 app.
23-
24- . PARAMETER MinimumMemoryInMB
25- Specify the minimum required memory in MB as a requirement for the Win32 app.
26-
27- . PARAMETER MinimumNumberOfProcessors
28- Specify the minimum number of required logical processors as a requirement for the Win32 app.
29-
30- . PARAMETER MinimumCPUSpeedInMHz
31- Specify the minimum CPU speed in Mhz (as an integer) as a requirement for the Win32 app.
32-
33- . NOTES
34- Author: Nickolaj Andersen
35- Contact: @NickolajA
36- Created: 2020-01-27
37- Updated: 2025-12-07
38-
39- Version history:
40- 1.0.0 - (2020-01-27) Function created
41- 1.0.1 - (2021-03-22) Added new minimum supported operating system versions to parameter validation
42- 1.0.2 - (2021-08-31) Added new minimum supported operating system versions to parameter validation
43- 1.0.3 - (2022-09-02) minimumSupportedOperatingSystem property is replaced by minimumSupportedWindowsRelease
44- 1.0.4 - (2022-10-02) minimumFreeDiskSpaceInMB, MinimumMemoryInMB, MinimumNumberOfProcessors and minimumCpuSpeedInMHz now adds a 'null' string
45- 1.0.5 - (2023-04-26) Added support for new Windows 10 and Windows 11 minimum operating system versions
46- 1.0.6 - (2023-09-04) Added alias of MinimumSupportedOperatingSystem to MinimumSupportedWindowsRelease
47- 1.0.7 - (2025-12-07) BREAKING: Added ARM64 support and switched to modern allowedArchitectures property by default
48- #>
49- [CmdletBinding (SupportsShouldProcess = $true )]
50- param (
51- [parameter (Mandatory = $true , HelpMessage = " Specify the architecture as a requirement for the Win32 app." )]
52- [ValidateNotNullOrEmpty ()]
53- [ValidateSet (" x64" , " x86" , " arm64" , " x64x86" , " AllWithARM64" )]
54- [string ]$Architecture ,
55-
56- [parameter (Mandatory = $true , HelpMessage = " Specify the minimum supported Windows release version as a requirement for the Win32 app." )]
57- [ValidateNotNullOrEmpty ()]
58- [ValidateSet (" W10_1607" , " W10_1703" , " W10_1709" , " W10_1803" , " W10_1809" , " W10_1903" , " W10_1909" , " W10_2004" , " W10_20H2" , " W10_21H1" , " W10_21H2" , " W10_22H2" , " W11_21H2" , " W11_22H2" , " W11_23H2" , " W11_24H2" )]
59- [Alias (' MinimumSupportedOperatingSystem' )]
60- [string ]$MinimumSupportedWindowsRelease ,
61-
62- [parameter (Mandatory = $false , HelpMessage = " Specify the minimum free disk space in MB as a requirement for the Win32 app." )]
63- [ValidateNotNullOrEmpty ()]
64- [int ]$MinimumFreeDiskSpaceInMB ,
65-
66- [parameter (Mandatory = $false , HelpMessage = " Specify the minimum required memory in MB as a requirement for the Win32 app." )]
67- [ValidateNotNullOrEmpty ()]
68- [int ]$MinimumMemoryInMB ,
69-
70- [parameter (Mandatory = $false , HelpMessage = " Specify the minimum number of required logical processors as a requirement for the Win32 app." )]
71- [ValidateNotNullOrEmpty ()]
72- [int ]$MinimumNumberOfProcessors ,
73-
74- [parameter (Mandatory = $false , HelpMessage = " Specify the minimum CPU speed in Mhz (as an integer) as a requirement for the Win32 app." )]
75- [ValidateNotNullOrEmpty ()]
76- [int ]$MinimumCPUSpeedInMHz
77- )
78- Process {
79- # Construct table for supported architectures
80- $ArchitectureTable = @ {
81- " x64" = " x64"
82- " x86" = " x86"
83- " arm64" = " arm64"
84- " x64x86" = " x64,x86"
85- " AllWithARM64" = " x64,x86,arm64"
86- }
87-
88- # Construct table for supported operating systems
89- $OperatingSystemTable = @ {
90- " W10_1607" = " 1607"
91- " W10_1703" = " 1703"
92- " W10_1709" = " 1709"
93- " W10_1803" = " 1803"
94- " W10_1809" = " 1809"
95- " W10_1903" = " 1903"
96- " W10_1909" = " 1909"
97- " W10_2004" = " 2004"
98- " W10_20H2" = " 2H20"
99- " W10_21H1" = " 21H1"
100- " W10_21H2" = " Windows10_21H2"
101- " W10_22H2" = " Windows10_22H2"
102- " W11_21H2" = " Windows11_21H2"
103- " W11_22H2" = " Windows11_22H2"
104- " W11_23H2" = " Windows11_23H2"
105- " W11_24H2" = " Windows11_24H2"
106- }
107-
108- # Construct ordered hash-table with least amount of required properties for default requirement rule
109- # Using modern allowedArchitectures property with applicableArchitectures set to none
110- $RequirementRule = [ordered ]@ {
111- " allowedArchitectures" = $ArchitectureTable [$Architecture ]
112- " applicableArchitectures" = " none"
113- " minimumSupportedWindowsRelease" = $OperatingSystemTable [$MinimumSupportedWindowsRelease ]
114- }
115-
116- # Add additional requirement rule details if specified on command line
117- if ($PSBoundParameters [" MinimumFreeDiskSpaceInMB" ]) {
118- $RequirementRule.Add (" minimumFreeDiskSpaceInMB" , $MinimumFreeDiskSpaceInMB )
119- }
120- if ($PSBoundParameters [" MinimumMemoryInMB" ]) {
121- $RequirementRule.Add (" minimumMemoryInMB" , $MinimumMemoryInMB )
122- }
123- if ($PSBoundParameters [" MinimumNumberOfProcessors" ]) {
124- $RequirementRule.Add (" minimumNumberOfProcessors" , $MinimumNumberOfProcessors )
125- }
126- if ($PSBoundParameters [" MinimumCPUSpeedInMHz" ]) {
127- $RequirementRule.Add (" minimumCpuSpeedInMHz" , $MinimumCPUSpeedInMHz )
128- }
129-
130- return $RequirementRule
131- }
1+ function New-IntuneWin32AppRequirementRule {
2+ <#
3+ . SYNOPSIS
4+ Construct a new requirement rule as an optional requirement for Add-IntuneWin32App cmdlet.
5+
6+ . DESCRIPTION
7+ Construct a new requirement rule as an optional requirement for Add-IntuneWin32App cmdlet.
8+
9+ . PARAMETER Architecture
10+ Specify the architecture as a requirement for the Win32 app.
11+ Supported values: x64, x86, arm64, x64x86, AllWithARM64.
12+ - x64: 64-bit Intel/AMD processors only
13+ - x86: 32-bit Intel/AMD processors only
14+ - arm64: 64-bit ARM processors only
15+ - x64x86: x64 and x86 (Intel/AMD architectures)
16+ - AllWithARM64: x64, x86, and arm64 (universal)
17+
18+ . PARAMETER MinimumSupportedWindowsRelease
19+ Specify the minimum supported Windows release version as a requirement for the Win32 app.
20+
21+ . PARAMETER MinimumFreeDiskSpaceInMB
22+ Specify the minimum free disk space in MB as a requirement for the Win32 app.
23+
24+ . PARAMETER MinimumMemoryInMB
25+ Specify the minimum required memory in MB as a requirement for the Win32 app.
26+
27+ . PARAMETER MinimumNumberOfProcessors
28+ Specify the minimum number of required logical processors as a requirement for the Win32 app.
29+
30+ . PARAMETER MinimumCPUSpeedInMHz
31+ Specify the minimum CPU speed in Mhz (as an integer) as a requirement for the Win32 app.
32+
33+ . NOTES
34+ Author: Nickolaj Andersen
35+ Contact: @NickolajA
36+ Created: 2020-01-27
37+ Updated: 2025-12-07
38+
39+ Version history:
40+ 1.0.0 - (2020-01-27) Function created
41+ 1.0.1 - (2021-03-22) Added new minimum supported operating system versions to parameter validation
42+ 1.0.2 - (2021-08-31) Added new minimum supported operating system versions to parameter validation
43+ 1.0.3 - (2022-09-02) minimumSupportedOperatingSystem property is replaced by minimumSupportedWindowsRelease
44+ 1.0.4 - (2022-10-02) minimumFreeDiskSpaceInMB, MinimumMemoryInMB, MinimumNumberOfProcessors and minimumCpuSpeedInMHz now adds a 'null' string
45+ 1.0.5 - (2023-04-26) Added support for new Windows 10 and Windows 11 minimum operating system versions
46+ 1.0.6 - (2023-09-04) Added alias of MinimumSupportedOperatingSystem to MinimumSupportedWindowsRelease
47+ 1.0.7 - (2025-12-07) BREAKING: Added ARM64 support and switched to modern allowedArchitectures property by default
48+ #>
49+ [CmdletBinding (SupportsShouldProcess = $true )]
50+ param (
51+ [parameter (Mandatory = $true , HelpMessage = " Specify the architecture as a requirement for the Win32 app." )]
52+ [ValidateNotNullOrEmpty ()]
53+ [ValidateSet (" x64" , " x86" , " arm64" , " x64x86" , " AllWithARM64" )]
54+ [string ]$Architecture ,
55+
56+ [parameter (Mandatory = $true , HelpMessage = " Specify the minimum supported Windows release version as a requirement for the Win32 app." )]
57+ [ValidateNotNullOrEmpty ()]
58+ [ValidateSet (" W10_1607" , " W10_1703" , " W10_1709" , " W10_1803" , " W10_1809" , " W10_1903" , " W10_1909" , " W10_2004" , " W10_20H2" , " W10_21H1" , " W10_21H2" , " W10_22H2" , " W11_21H2" , " W11_22H2" )]
59+ [Alias (' MinimumSupportedOperatingSystem' )]
60+ [string ]$MinimumSupportedWindowsRelease ,
61+
62+ [parameter (Mandatory = $false , HelpMessage = " Specify the minimum free disk space in MB as a requirement for the Win32 app." )]
63+ [ValidateNotNullOrEmpty ()]
64+ [int ]$MinimumFreeDiskSpaceInMB ,
65+
66+ [parameter (Mandatory = $false , HelpMessage = " Specify the minimum required memory in MB as a requirement for the Win32 app." )]
67+ [ValidateNotNullOrEmpty ()]
68+ [int ]$MinimumMemoryInMB ,
69+
70+ [parameter (Mandatory = $false , HelpMessage = " Specify the minimum number of required logical processors as a requirement for the Win32 app." )]
71+ [ValidateNotNullOrEmpty ()]
72+ [int ]$MinimumNumberOfProcessors ,
73+
74+ [parameter (Mandatory = $false , HelpMessage = " Specify the minimum CPU speed in Mhz (as an integer) as a requirement for the Win32 app." )]
75+ [ValidateNotNullOrEmpty ()]
76+ [int ]$MinimumCPUSpeedInMHz
77+ )
78+ Process {
79+ # Construct table for supported architectures
80+ $ArchitectureTable = @ {
81+ " x64" = " x64"
82+ " x86" = " x86"
83+ " arm64" = " arm64"
84+ " x64x86" = " x64,x86"
85+ " AllWithARM64" = " x64,x86,arm64"
86+ }
87+
88+ # Construct table for supported operating systems
89+ $OperatingSystemTable = @ {
90+ " W10_1607" = " 1607"
91+ " W10_1703" = " 1703"
92+ " W10_1709" = " 1709"
93+ " W10_1803" = " 1803"
94+ " W10_1809" = " 1809"
95+ " W10_1903" = " 1903"
96+ " W10_1909" = " 1909"
97+ " W10_2004" = " 2004"
98+ " W10_20H2" = " 2H20"
99+ " W10_21H1" = " 21H1"
100+ " W10_21H2" = " Windows10_21H2"
101+ " W10_22H2" = " Windows10_22H2"
102+ " W11_21H2" = " Windows11_21H2"
103+ " W11_22H2" = " Windows11_22H2"
104+ }
105+
106+ # Construct ordered hash-table with least amount of required properties for default requirement rule
107+ # Using modern allowedArchitectures property with applicableArchitectures set to none
108+ $RequirementRule = [ordered ]@ {
109+ " allowedArchitectures" = $ArchitectureTable [$Architecture ]
110+ " applicableArchitectures" = " none"
111+ " minimumSupportedWindowsRelease" = $OperatingSystemTable [$MinimumSupportedWindowsRelease ]
112+ }
113+
114+ # Add additional requirement rule details if specified on command line
115+ if ($PSBoundParameters [" MinimumFreeDiskSpaceInMB" ]) {
116+ $RequirementRule.Add (" minimumFreeDiskSpaceInMB" , $MinimumFreeDiskSpaceInMB )
117+ }
118+ if ($PSBoundParameters [" MinimumMemoryInMB" ]) {
119+ $RequirementRule.Add (" minimumMemoryInMB" , $MinimumMemoryInMB )
120+ }
121+ if ($PSBoundParameters [" MinimumNumberOfProcessors" ]) {
122+ $RequirementRule.Add (" minimumNumberOfProcessors" , $MinimumNumberOfProcessors )
123+ }
124+ if ($PSBoundParameters [" MinimumCPUSpeedInMHz" ]) {
125+ $RequirementRule.Add (" minimumCpuSpeedInMHz" , $MinimumCPUSpeedInMHz )
126+ }
127+
128+ return $RequirementRule
129+ }
132130}
0 commit comments