DL group contains a specific name

how do you searh for  a specific distubution group in Exchange 2010 via powershell

for example all the groups starts with or ends with "partner"

I need list of all the DLs in our enviroment
kuzumAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

becraigCommented:
Get-DistributionGroup | ? {$_.Name -like "partner*" -or $_.Name -like "*partner"} | export-csv c:\dlreport.csv -nti

Open in new window

That should do it
0
kuzumAuthor Commented:
thanks, it is asking for -resultsize unlimited command?
0
becraigCommented:
should be optional but you can add it.

Get-DistributionGroup -ResultSize Unlimited | ? {$_.Name -like "partner*" -or $_.Name -like "*partner"} | export-csv c:\dlreport.csv -nti

Open in new window

0
How do you know if your security is working?

Protecting your business doesn’t have to mean sifting through endless alerts and notifications. With WatchGuard Total Security Suite, you can feel confident that your business is secure, meaning you can get back to the things that have been sitting on your to-do list.

kuzumAuthor Commented:
received this;
WARNING: The property value is invalid. The value can't contain leading or trailing whitespace"  ?
0
becraigCommented:
What do you get when you run:

Get-DistributionGroup -resultsize unlimited
0
kuzumAuthor Commented:
received
Name                          DisplayName                   GroupType                     PrimarySmtpAddress
   xx                                        xx                                         xx                                        xx

where xx  is details

and below warning

WARNING: The object ourdomain.com/NR Groups/NR Distribution Groups/China/Hong Kong/Sync to All/Support
Heads has been corrupted, and it's in an inconsistent state. The following validation errors happened:
WARNING: Property expression "Asia-ITSupport(Heads)" isn't valid. Valid values are: Strings formed with characters from
 A to Z (uppercase or lowercase), digits from 0 to 9, !, #, $, %, &, ', *, +, -, /, =, ?, ^, _, `, {, |, } or ~. One or
 more periods may be embedded in an alias, but each period should be preceded and followed by at least one of the other
 characters. Unicode characters from U+00A1 to U+00FF are also valid in an alias, but they will be mapped to a best-fit
 US-ASCII string in the e-mail address, which is generated from such an alias.
0
becraigCommented:
ok so that is the problem you have DLs that do not match the required naming conventions and need to be updated :~(

You need to update this to not be Asia-ITSupport(Heads)
Find that DL and edit it.
you can probably update to Asia-ITSupport-Heads


Then try again
0
kuzumAuthor Commented:
when I search in GUI and said alias contains the word I want it finds it all. SO please amend the code to say alias contains "partner"
0
kuzumAuthor Commented:
any ideas please?
0
becraigCommented:
Shay Levi has a fix for this at his blog:
http://blogs.microsoft.co.il/scriptfanatic/2011/08/15/exchange-removing-illegal-alias-characters-using-powershell/


you can give the script a once over, you should be able to run it against all your DLs and it will clean up the naming.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
becraigCommented:
I am guessing you are asking to have the query just get it once it contains partner and not if it starts or ends with partner ?

Get-DistributionGroup -ResultSize Unlimited | ? {$_.Name -like "*partner*"} | export-csv c:\dlreport.csv -nti

Open in new window

0
becraigCommented:
Did you perform a cleanup on your DL names and did the script above fetch the required output ?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Exchange

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.