Hello.
Hopefully not completely a wrong forum, but I have tried to search the answer to get a CSV file to list all contacts and their memberships. However as I've read memberof doesn't seem to be one of the attributes for Contacts, or am I mistaken? Maybe I cannot
phrase the proper search word to find the script which I need.
I am using exchange shell for my query.
This is what am using at the present moment, the contacts I want (almost with some extras) get printed to the file. But it doesn't seem to list the contacts membership. How can I get that to be added to the file?
Get-MailContact -resultsize unlimited -Filter {(RecipientType -eq "MailContact") -or (PrimarySmtpAddress -ne "*@gmail.com")} |
Select-Object -Property PrimarySmtpAddress,Alias,memberof | Export-Csv "C:\Users\username\Desktop\test1.csv" -noTypeInformation
And my second question is how to properly filter out contacts which contain certain words or with certain email address suffixes? Cause right not -ne command is not really working and I still get the contacts which I don't want to be listed. Also the contacts
which I do not need are in certain subOU of the contact OU.
Any help or guidance to a simple code would be much appriciated.