|
2 | 2 | description: Use this topic to help manage Windows and Windows Server technologies with Windows PowerShell. |
3 | 3 | external help file: Microsoft.ConfigCI.Commands.dll-Help.xml |
4 | 4 | Module Name: ConfigCI |
5 | | -ms.date: 12/20/2016 |
| 5 | +ms.date: 05/23/2022 |
6 | 6 | online version: https://docs.microsoft.com/powershell/module/configci/new-cipolicyrule?view=windowsserver2022-ps&wt.mc_id=ps-gethelp |
7 | 7 | schema: 2.0.0 |
8 | 8 | title: New-CIPolicyRule |
@@ -202,43 +202,79 @@ This command generates a filepath rule for the specific path verbatim string. Th |
202 | 202 |
|
203 | 203 | ### Example 5: Create a policy rule for a packaged application and its dependencies |
204 | 204 | ``` |
205 | | -PS C:\> $package = Get-AppxPackage -Name *Microsoft.Whiteboard* |
206 | | -PS C:\> $package_dependencies = $package.Dependencies |
207 | | -
|
208 | | -PS C:\> $package_rule = New-CIPolicyRule -Package $package |
209 | | -PS C:\> $package_rule += New-CIPolicyRule -Package $dependency[0] # repeat for all dependencies in array |
210 | | -``` |
211 | | -```output |
212 | | -PS C:\> $package_rule |
213 | | -
|
214 | | -
|
215 | | -Name : Microsoft.Whiteboard_8wekyb3d8bbwe FileRule |
216 | | -Id : ID_ALLOW_A_D |
| 205 | +PS C:\> $packages = Get-AppxPackage -Name *Microsoft* |
| 206 | +PS C:\> $packages |
| 207 | +
|
| 208 | +Name : Microsoft.NET.Native.Runtime.1.4 |
| 209 | +Publisher : CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US |
| 210 | +Architecture : X86 |
| 211 | +ResourceId : |
| 212 | +Version : 1.4.24201.0 |
| 213 | +PackageFullName : Microsoft.NET.Native.Runtime.1.4_1.4.24201.0_x86__8wekyb3d8bbwe |
| 214 | +InstallLocation : C:\Program Files\WindowsApps\Microsoft.NET.Native.Runtime.1.4_1.4.24201.0_x86__8wekyb3d8bbwe |
| 215 | +IsFramework : True |
| 216 | +PackageFamilyName : Microsoft.NET.Native.Runtime.1.4_8wekyb3d8bbwe |
| 217 | +PublisherId : 8wekyb3d8bbwe |
| 218 | +IsResourcePackage : False |
| 219 | +IsBundle : False |
| 220 | +IsDevelopmentMode : False |
| 221 | +NonRemovable : False |
| 222 | +IsPartiallyStaged : False |
| 223 | +SignatureKind : Store |
| 224 | +Status : Ok |
| 225 | +... |
| 226 | +Name : Microsoft.NET.Native.Runtime.1.4 |
| 227 | +Publisher : CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US |
| 228 | +Architecture : X64 |
| 229 | +ResourceId : |
| 230 | +Version : 1.4.24201.0 |
| 231 | +PackageFullName : Microsoft.NET.Native.Runtime.1.4_1.4.24201.0_x64__8wekyb3d8bbwe |
| 232 | +InstallLocation : C:\Program Files\WindowsApps\Microsoft.NET.Native.Runtime.1.4_1.4.24201.0_x64__8wekyb3d8bbwe |
| 233 | +IsFramework : True |
| 234 | +PackageFamilyName : Microsoft.NET.Native.Runtime.1.4_8wekyb3d8bbwe |
| 235 | +PublisherId : 8wekyb3d8bbwe |
| 236 | +IsResourcePackage : False |
| 237 | +IsBundle : False |
| 238 | +IsDevelopmentMode : False |
| 239 | +NonRemovable : False |
| 240 | +IsPartiallyStaged : False |
| 241 | +SignatureKind : Store |
| 242 | +Status : Ok |
| 243 | +
|
| 244 | +$package_dependencies = $packages.Dependencies |
| 245 | +$package_rule = New-CIPolicyRule -Package $packages[0] #repeat for all desired packages in the array |
| 246 | +$package_rule += New-CIPolicyRule -Package $package_dependencies[0] # repeat for all dependencies in the array |
| 247 | +$package_rule |
| 248 | +
|
| 249 | +Name : Microsoft.NET.Native.Runtime.1.4_8wekyb3d8bbwe FileRule |
| 250 | +Id : ID_ALLOW_A_1 |
217 | 251 | TypeId : Allow |
218 | | -Root : |
219 | | -FileVersionRef : |
220 | | -AppIDRef : |
| 252 | +Root : |
| 253 | +FileVersionRef : |
| 254 | +AppIDRef : |
221 | 255 | Wellknown : False |
222 | | -Ekus : |
223 | | -Exceptions : |
224 | | -FileAttributes : |
| 256 | +Ekus : |
| 257 | +Exceptions : |
| 258 | +FileAttributes : |
225 | 259 | FileException : False |
226 | 260 | UserMode : True |
227 | | -attributes : {[AppIDs, ], [MinimumFileVersion, 0.0.0.0], [PackageFamilyName, Microsoft.Whiteboard_8wekyb3d8bbwe], [PackageVersion, 21.10503.5662.0]} |
| 261 | +attributes : {[AppIDs, ], [MinimumFileVersion, 0.0.0.0], [PackageFamilyName, |
| 262 | + Microsoft.NET.Native.Runtime.1.4_8wekyb3d8bbwe], [PackageVersion, 1.4.24201.0]} |
228 | 263 |
|
229 | | -Name : Microsoft.NET.Native.Runtime.2.2_8wekyb3d8bbwe FileRule |
230 | | -Id : ID_ALLOW_A_E |
| 264 | +Name : Microsoft.NET.Native.Framework.2.2_8wekyb3d8bbwe FileRule |
| 265 | +Id : ID_ALLOW_A_2 |
231 | 266 | TypeId : Allow |
232 | | -Root : |
233 | | -FileVersionRef : |
234 | | -AppIDRef : |
| 267 | +Root : |
| 268 | +FileVersionRef : |
| 269 | +AppIDRef : |
235 | 270 | Wellknown : False |
236 | | -Ekus : |
237 | | -Exceptions : |
238 | | -FileAttributes : |
| 271 | +Ekus : |
| 272 | +Exceptions : |
| 273 | +FileAttributes : |
239 | 274 | FileException : False |
240 | 275 | UserMode : True |
241 | | -attributes : {[AppIDs, ], [MinimumFileVersion, 0.0.0.0], [PackageFamilyName, Microsoft.NET.Native.Runtime.2.2_8wekyb3d8bbwe], [PackageVersion, 2.2.28604.0]} |
| 276 | +attributes : {[AppIDs, ], [MinimumFileVersion, 0.0.0.0], [PackageFamilyName, |
| 277 | + Microsoft.NET.Native.Framework.2.2_8wekyb3d8bbwe], [PackageVersion, 2.2.29512.0]} |
242 | 278 | ``` |
243 | 279 |
|
244 | 280 | This set of commands finds a packaged application matching the specified name and generates an allow rule for the packaged application and its dependencies. |
|
0 commit comments