Private/Test-UnusedWithPermissions.ps1
function Test-UnusedWithPermissions { param ( [array]$accessLog90days, [int]$permissionCount ) if ($accessLog90days -eq $null -or $permissionCount -lt 0) { return 2 } $sumActionCount = 0 foreach ($log in $accessLog90days) { $actionCount = $log.access.Value.actionCount $sumActionCount += $actionCount } if ($sumActionCount -eq 0 -and $permissionCount -gt 1) { return 0 } return 1 } # SIG # Begin signature block # MIIdKgYJKoZIhvcNAQcCoIIdGzCCHRcCAQExDzANBglghkgBZQMEAgEFADB5Bgor # BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG # KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCA5uVgKBUhgTBXb # v2gUUpC/DLvjModgUDRCAzLq74NiYaCCA0YwggNCMIICKqADAgECAhAdkYHz+qFO # vkQjYqzHr3pKMA0GCSqGSIb3DQEBCwUAMDkxNzA1BgNVBAMMLkNvZGVTaWduaW5n # IENlcnRpZmljYXRlIGZvciBQb3dlclNoZWxsIE1vZHVsZXMwHhcNMjQwNjEyMDUw # ODAyWhcNMjUwNjEyMDUyODAyWjA5MTcwNQYDVQQDDC5Db2RlU2lnbmluZyBDZXJ0 # aWZpY2F0ZSBmb3IgUG93ZXJTaGVsbCBNb2R1bGVzMIIBIjANBgkqhkiG9w0BAQEF # AAOCAQ8AMIIBCgKCAQEAwdSzTBb7ni0tRubblITxoGHzXlvwu8Y5ndoElOvIKaey # AFW8+tYCPG5zATsoGGE3f8g6Wtv8JgEjH45ZOhRBjghEVpw/9Iszal5SmucjUlqB # fMvts+M/x9G7h6GGAQFy65xgQqyCVJA10x2NDheb7cBRCRRZVkT+CUv1dbS41bsO # BMKDUTumbU7vHk2FSJ5H6f31cj238qboI4g2GD2gIsWID+GhAfzxrmXMV6VgMKqW # GNlK5g/X2tSM6Aygnx1itXrrV3LwDOYiAAs+j87jEsYhxe3CnFgtDsi4UtW/lFem # eEiOh9Vd6LaTx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