The script below get the transport rule based on the GUID and then display also the exemption group for that rule. WHat i want is that to display also the member of the exemption group (ex. FromMemberOf)
If i check the content of the variable ($group.FromMemberOf) I would see that it has 2 DL groups (pic 1). But if i try to use FOreach-Object to display further its members i get an error that it cannot convert the identity (pic 2). Is it because the variable being stored is of different type?
Param(
[parameter(Mandatory=$true)][string]$sid,
[parameter(Mandatory=$true)][string[]]$ExchGuid)
# Arrays
$TRule_Info = @()
$DL_Info = @()
$DL_nested = @()
$From_Member = @()
$From_MemberInfo = @()
foreach ($rule in $ExchGuid){
$TRule_Info = Get-TransportRule | where guid -EQ $rule
foreach ($group in $TRule_Info){
$ht = [pscustomobject]@{
SID = $sid
RuleID = $group.Guid
RuleName = $group.Name
Reject_Code = $group.RejectMessageEnhancedStatusCode
Except_MemberOf_DL = $group.ExceptIfFromMemberOf
Except_SentTo_DL = $group.ExceptIfSentToMemberOf
SentToMemberOf_DL_BlockGroup = $group.SentToMemberOf
FromMemberOf_DL_BlockGroup = $group.FromMemberOf
}
# Displays the information of the Transport Rule as per defined in var $ht
$DL_Info += $ht
}
}
$DL_Info
PoSH newbie, BaSH Oldie