Functions/HealthCheck/UserGroups/Get-AMHCEmptyUserGroup.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
function Get-AMHCEmptyUserGroup {
    <#
        .SYNOPSIS
            Empty User Groups
 
        .DESCRIPTION
            User groups that don't have any members
 
        .PARAMETER UserGroups
            The user groups to perform health check against
    #>

    [CmdletBinding()]
    param (
        [Parameter(Mandatory = $true)]
        [AllowNull()]
        $UserGroups
    )

    foreach ($userGroup in $UserGroups) {
        if ($userGroup.UserIDs.Count -eq 0) {
            [AMConstructHealthCheckItem]::New($userGroup, "Empty")
        }
    }
}