Public/Sort-ALRulesetRule.ps1
|
<# .SYNOPSIS Sorts rules in the given paths by ID. #> function Sort-ALRulesetRule { param ( [Parameter(Mandatory, Position = 0, ValueFromPipeline, ValueFromPipelineByPropertyName)] [Alias("FullName")] [string[]]$Path ) process { $Path | ForEach-Object { Get-Content -Path $_ -Raw | ConvertFrom-Json -Depth 5 | ForEach-Object { $_.rules = $_.rules | Sort-Object -Property ID; $_ } | ConvertTo-Json -Depth 5 | Set-Content -Path $_ -NoNewline } } } |