I need to create about 300 dynamic distribution lists (oh joy) and am trying to use PoSH to do so but having some problems with the variables inside the -recipientfilter not expanding i'm pretty sure its due to the curly brackets but nothing I have tried has worked so far.
Basically I am trying to do this:
$Dept = 'Technician Production' $Branch = "10" New-DynamicDistributionGroup -Name $Branch$Dept -RecipientFilter {(RecipientType -eq 'UserMailbox'-and (Office -like "$Branch*" -or CustomAttribute2 -like "*$Branch*") -and (Department -like "$Dept" -or CustomAttribute1 -like "*$Dept*"))}
which creates the list but none of the variables are expanded.
Once I can get this working i'll add the parts for reading from a csv and looping through it to create all the lists but that part I can usually do fairly easy.
Thanks for any assistance!
-C