Public/Get-Team.ps1

Function Get-Team {
    [CmdletBinding()]
    param (
        [Parameter(
            ValueFromPipelineByPropertyName
        )]
        $Manager,
        [Parameter(
            ValueFromPipelineByPropertyName
        )]
        [Alias("SamAccountName", "DistinguishedName", "GUID", "SID", "EmployeeID", "mail", "UserPrincipalName")]
        $Identity = $ENV:USERNAME,
        [string[]]$Properties = @("Name", "EmployeeID", "physicalDeliveryOfficeName", "Title", "mail", "msRTCSIP-PrimaryUserAddress", "CanonicalName", "DistinguishedName", "samaccountname", "UserPrincipalname", "AccountExpirationDate", "Enabled", "Manager", "badPwdCount", "LastBadPasswordAttempt", "LockedOut", "LockOutTime", "lastLogonDate", "PasswordExpired", "PasswordLastSet", "whenCreated", "whenChanged"),
        [string[]]$Select = @("Name", "EmployeeID", "physicalDeliveryOfficeName", "Title", "mail", "msRTCSIP-PrimaryUserAddress", "CanonicalName", "DistinguishedName", "samaccountname", "UserPrincipalname", "AccountExpirationDate", "Enabled", "Manager", "badPwdCount", "LastBadPasswordAttempt", "LockedOut", "LockOutTime", "lastLogonDate", "PasswordExpired", "PasswordLastSet", "whenCreated", "whenChanged")
    )
    BEGIN {}
    PROCESS {
        if ($Manager) {
            Write-Verbose "Searching based on ($Manager)"
            $Users = Get-ADUser -Filter "manager -eq '$Manager'" -Properties $Properties | Select-Object $Select
            Return $Users
        }
        elseif ($Search) {
            $Users = @()
            foreach ($SearchTerm in $Search) {
                $Manager = (Get-ADUser -Filter "employeeid -eq '$SearchValue' -or SamAccountName -eq '$SearchValue' -or DistinguishedName -eq '$SearchValue' -or GUID -eq '$SearchValue' -or SID -eq '$SearchValue' -or EmployeeID -eq '$SearchValue' -or mail -eq '$SearchValue' -or UserPrincipalName -eq '$SearchValue'" -Properties Manager).Manager
                $Users += Get-ADUser -Filter "manager -eq '$Manager'" -Properties $Properties | Select-Object $Select
            }  
            Return $Users     
        }
        else {
            Write-Warning "No Search Info Provided"
        } 
    }
    END {}
}