|
function get-member
{
[CmdletBinding()]
[Alias()]
[OutputType([int])]
Param
(
# Param1 help description
[Parameter(Mandatory=$true,
ValueFromPipelineByPropertyName=$true,
ValueFromPipeline=$true,
Position=0)]
[string]
$name
)
Begin
{
}
Process
{
$a=Get-DistributionGroupMember $name -ErrorAction SilentlyContinue
if($a -eq $null){
return
}
foreach($b in $a){
if (($b.Recipienttype -eq'Usermailbox') -or ($b.Recipienttype -eq 'MailContact') -or ($b.Recipienttype -eq 'User')){
write-host $b.name -ForegroundColor DarkYellow
}
else{
if($b.primarysmtpaddress -eq ""){
write-host $b.name -ForegroundColor red
}
else{
write-host $b.name -ForegroundColor Cyan
get-member $b.name
}
}
}
}
End
{
}
}
|
|
|