Private/Get-NSPConditionalAccessIpLocationKey.ps1
|
function Get-NSPConditionalAccessIpLocationKey { <# .SYNOPSIS A comparable form of an IP named location: name, trusted flag, and sorted ranges. .DESCRIPTION Used the way policy hashes are: the plan records the key it saw, and the run refuses to write over a location whose key changed since. #> [CmdletBinding()] [OutputType([string])] param( [Parameter(Mandatory)]$Location ) $ranges = @(Get-NSPConditionalAccessMapValue $Location 'ipRanges' | Where-Object { $_ } | ForEach-Object { [string](Get-NSPConditionalAccessMapValue $_ 'cidrAddress') }) | Sort-Object '{0}|{1}|{2}' -f (Get-NSPConditionalAccessMapValue $Location 'displayName'), [bool](Get-NSPConditionalAccessMapValue $Location 'isTrusted'), ($ranges -join ',') } |