
And since I've gotten tons of useful tips and scripting examples from folks like Paul Cunningham and Shay Levy, I've decided to give back some tips & code-bits to help other folks quickly tackle their own admin needs with Powershell & Exchange Management Shell.
Report on Distribution Groups with AcceptMessageOnlyFrom set
Toward that end, here's a piece of code I put together some time ago, to pull out all Distribution Groups with the AcceptMessagesOnlyFrom, and then concatonate together the AcceptMessagesOnlyFrom strings, and export the results to CSV file.
Get-DistributionGroup -filter { AcceptMessagesOnlyFrom -ne $null} |Typical output csv contents: (heading and first line)
select Name,@{Name="AcceptMessagesOnlyFrom";Expression={ `
[string]::join(";",$_.AcceptMessagesOnlyFrom) } } |
export-csv .\dlacceptmessages.csv -notype
"Name","AcceptMessagesOnlyFrom"
"X Domain Admins","OU/United States/Users/Blow, Joe;OU/United States/Users/Blow, Josie"
The components of the command used are a simple Get-DistributionGroup command leveraging the -filter parameter to retrieve matches, piped into a Select command that retrieves the Name attribute and a custom field that joins the multiple AcceptMessageOnlyFrom strings into a single semi-colon-delimited string. The export-csv then outputs the Name & AcceptMessagesOnlyFrom values to the specified CSV file.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.