DynamicDistributionGroup for all users in a particular storage group

Sorry Evan, but just to correct you a little bit. ;-) but you need in get-mailboxdatabase and –organizationalUnit in New-DynamicDistributionGroup

To create a DDL for each DB in an SG

get-mailboxdatabase -StorageGroup | % { New-DynamicDistributionGroup “DDG-$($_.Name)” –organizationalUnit  / -RecipientFilter “Database -eq ‘$($_.Identity.DistinguishedName)'” }

So now the BIG issue is how to the a list of the members! 

I blogged this ages ago: http://blogs.flaphead.dns2go.com/archive/2007/05/10/exchange-2007-dynamic-distributions-groups.aspx

But you could do this and create a DDL for each DB on the server,as you would (in theory) have a 1:1 ratio for SG:DB

#Create DDL for a Server
$Server = “SUKMSDMBX03”
$DDLalias = “DDL-$Server”
$DDLName = “zz $server”
$DDLOU = “exchorg.local/MyOU/pf”
New-DynamicDistributionGroup -alias “$DDLalias” -name “$DDLName” -recipientfilter {ServerName -eq $Server} –organizationalUnit “$DDLou”

$ddl = Get-DynamicDistributionGroup “$DDLName”
get-recipient -filter $ddl.recipientfilter

#Create DDL for Exchange SG on that Server
$MBX = Get-MailboxDatabase -Server $server

foreach ($db in $mbx)
{
    $dbPath = $db.DistinguishedName.ToString()
    $dbDDLName = $db.name
    $dbDDLName = “BW MS ” + $dbDDLName
    New-DynamicDistributionGroup $dbDDLName  –organizationalUnit
“$DDLou” -RecipientFilter {database -eq $dbpath}
    
}

 

8 Random Things

Ah well I suppose I shouldn’t be a grumpy old git and respond to this one.  So thanks Eileen and Anna

  1. I have two kittens (who today are getting “done”!)
  2. My middle name is Bryan
  3. My first MCP was in Word 2.0
  4. I am doing an OU degree
  5. I maybe going to court soon!
  6. I used to be a database programmer, using dbase and foxpro
  7. I spent 3 year of my life on working on the Morgan Stanley Building at Canary Wharf
  8. I used to work in Portugal (but never picked the language up!)

That was hard, so to abuse 8 more people, this should be fun, so my old collegue Mark, another couple of old buddies, Ewan and Brett, a couple of MVPs too for the mix Anderson and Rui, so a couple of others Ali, Colin an finally the lovely Jane