Register
: :
Login
Home
News
Forums
Scripts
User Groups
Resources
About
Forums
Search
Members
Unanswered
Active Topics
Forums
>
Using PowerShell
>
Exchange Server
passing variable to recipientfilter not working
Last Post 15 Jul 2010 03:50 AM by
Kieran Kennedy
. 1 Replies.
Sort:
Oldest First
Most Recent First
Prev
Next
You are not authorized to post a reply.
Author
Messages
Kieran Kennedy
New Member
Posts:2
14 Jul 2010 07:36 AM
I have this small piece of script to create a dynamicdistributionlist and set one of the custom fields
CSV file is
title,year
Group1,1
$GroupFile = import-csv .\groups.csv -OutVariable string
foreach ($Group in $GroupFile)
{
$GroupName = $group.title
$GroupYear = $group.year
Echo "Adding $GroupName"
New-DynamicDistributionGroup -Name $GroupName -RecipientFilter{(Recipienttype -eq "UserMailbox") -and (Title -eq $GroupName)}
Set-DynamicdistributionGroup $GroupName -CustomAttribute1 $GroupYear
}
As you can see below the $GroupName variable is not being passed for the Title filter
((RecipientType -eq 'UserMailbox' -and -not(Title -ne $null)) -and -not(Name -
like 'SystemMailbox{*') -and -not(Name -like 'CAS_{*') -and -not(RecipientType
DetailsValue -eq 'MailboxPlan') -and -not(RecipientTypeDetailsValue -eq 'Arbit
rationMailbox'))
Any suggentions?
Thanks
Kieran
Kieran Kennedy
New Member
Posts:2
15 Jul 2010 03:50 AM
Found the answer
New-DynamicDistributionGroup -Name $GroupName -RecipientFilter{(Recipienttype -eq "UserMailbox") -and (Title -eq $GroupName)}
Changed to
New-DynamicDistributionGroup -Name $GroupName -RecipientFilter"Recipienttype -eq 'UserMailbox' -and Title -eq '$GroupName'"
You are not authorized to post a reply.
Using PowerShell
--General PowerShell
--Books, Tools, and Videos
--Exchange Server
--Active Directory
--System Center Family
--Non-Microsoft Products
--SharePoint
--SQL Server
--Working with .NET
--Peer Review
--Testing, Testing...
PowerShell Development
--Cmdlet Development
--PSDrive Provider Development
--Hosting the Shell
Looking Ahead
--Using PowerShell v2.0
--Developing for PowerShell v2.0
PowerShellCommunity.org
--Community Announcements and Assistance
--Completely Unrelated
--User Groups
--Community Business
----Suggestion Box
Forums
>
Using PowerShell
>
Exchange Server
Active Forums 4.3
Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 R2