Hi,
I'm trying to check whether mailcontact a is member of distributionlist b.
I've been wrestling with this for some hours now and can't find a solution.
so the command that should be passed is :
Get-DistributionGroupMember -Identity "b" | ft -autosize ExternalEmailAddress
I need to pipe it to get the email addresses of the members. Otherwise it only returns the name and type.
Try 1 ( String.Format )
string.Format("Get-DistributionGroupMember -Identity \"{0}\" | ft -autosize ExternalEmailAddress",distributionListAlias)
When I pass this string through powershell he says that Get-DistributionGroupMember is not a cmdlet .....
Passing only "Get-MailContact" does work, do I try to do string.Format(" Get-MailContact -Identity \"{0}\"",distributionListAlias), I get the same error but on Get-MailContact.
So it's not a problem with the Exchange PSplugin, I load that in my RunSpaceConfiguration
Try 2 ( Pipeline attempt 1)
Command pwCommand = new Command("Get-DistributionGroupMember");
CommandParameter thisParam = new CommandParameter("Identity", distributionListAlias);
pwCommand.Parameters.Add(thisParam);
string commandScript = "ft -autosize ExternalEmailAddress";
and I add those two to my pipe, same error on ft, cmdlet UnknownCommandExeption.
Try 3 (Pipeline attempt 2)
Tried to figure out how I could simulate the "ft -autosize ExternalEmailAddress" via a command object, but no luck.
Can anybody help me please?
Regards,
Sven Peeters
Belgium