@@ -202,43 +202,79 @@ This command generates a filepath rule for the specific path verbatim string. Th
202202
203203### Example 5: Create a policy rule for a packaged application and its dependencies
204204```
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
217251TypeId : Allow
218- Root :
219- FileVersionRef :
220- AppIDRef :
252+ Root :
253+ FileVersionRef :
254+ AppIDRef :
221255Wellknown : False
222- Ekus :
223- Exceptions :
224- FileAttributes :
256+ Ekus :
257+ Exceptions :
258+ FileAttributes :
225259FileException : False
226260UserMode : 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]}
228263
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
231266TypeId : Allow
232- Root :
233- FileVersionRef :
234- AppIDRef :
267+ Root :
268+ FileVersionRef :
269+ AppIDRef :
235270Wellknown : False
236- Ekus :
237- Exceptions :
238- FileAttributes :
271+ Ekus :
272+ Exceptions :
273+ FileAttributes :
239274FileException : False
240275UserMode : 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]}
242278```
243279
244280This 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