Get-DistributionGroup Where
Get-DistributionGroup Where domain is @ab.com or @123.com
how do I get the list of Distribution list for a particular domain.
September 1st, 2010 3:26pm
Get the distributiongroups where the primary smt address is @ab.com:
get-distributiongroup | where {$_.primarysmtpaddress -like "*@ab.com*"}
Get distributiongroups where any of the email addresses are @ab.com:
get-distributiongroup | where {[string]$_.emailaddresses -like "*@ab.com*"}
[string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "
Free Windows Admin Tool Kit Click here and download it now
September 1st, 2010 3:39pm
Could this be what you are looking for:
Get-DistributionGroup | where {$_.PrimarySmtpAddress -like "*domain.com"}Martin Sundstrm | Microsoft Certified Trainer | MCITP: Enterprise Messaging Administrator 2007/2010 |
http://msundis.wordpress.com
September 1st, 2010 3:39pm
Martin
Could this be what you are looking for:
Get-DistributionGroup | where {$_.PrimarySmtpAddress -like "*domain.com"}
this command runs but there is no output.
Free Windows Admin Tool Kit Click here and download it now
September 1st, 2010 5:49pm
[PS] C:\Users\administrator.EAFG\Desktop>get-distributiongroup | where {$_.primarysmtpaddress -like
*@abc.us*}
You must provide a value expression on the right-hand side of the '-like' operator.
At line:1 char:59
+ get-distributiongroup | where {$_.primarysmtpaddress -like <<<<
*@abc.us*}
[PS] C:\Users\administrator.EAFG\Desktop>
September 1st, 2010 5:49pm
Note the " surrounding the *domain.com in my example: "*domain.com"
Keep the two " and just replace the domain.Martin Sundstrm | Microsoft Certified Trainer | MCITP: Enterprise Messaging Administrator 2007/2010 |
http://msundis.wordpress.com
Free Windows Admin Tool Kit Click here and download it now
September 1st, 2010 5:51pm
That was my fault. The comparison strings need to be quoted. I've corrected the original post.
get-distributiongroup | where {$_.primarysmtpaddress -like "*@ab.com*"}[string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "
September 1st, 2010 5:56pm
Did you change domain.com to the domain you are looking for?Martin Sundstrm | Microsoft Certified Trainer | MCITP: Enterprise Messaging Administrator 2007/2010 |
http://msundis.wordpress.com
Free Windows Admin Tool Kit Click here and download it now
September 1st, 2010 6:10pm
Martin - this is the correct syntax for the cmdlet and it worked for me
[PS] C:\Users\administrator.EAFG\Desktop>Get-DistributionGroup | where {$_.PrimarySmtpAddress -like "*abc.us*"}
September 1st, 2010 6:37pm
Great that you got it working!Martin Sundstrm | Microsoft Certified Trainer | MCITP: Enterprise Messaging Administrator 2007/2010 |
http://msundis.wordpress.com
Free Windows Admin Tool Kit Click here and download it now
September 1st, 2010 6:46pm