Quantcast
Channel: Exchange Server 2013 - General Discussion forum
Viewing all articles
Browse latest Browse all 4521

Using PowerShell to create multiple dynamic dist groups but variables not expanding.

$
0
0

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

Viewing all articles
Browse latest Browse all 4521

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>