Issue removing managed folder MB policy via script (Full Version)

All Forums >> [Microsoft Exchange 2007] >> Compliance


tfd6412 -> Issue removing managed folder MB policy via script (2.Mar.2012 1:55:57 PM)

Hey all,

I'm trying to create a script that will assign a Managed Folder Mailbox Policy based on Distribution Group membership. I can assign it just fine. But there is a Distribution Group called "LEGALHOLD" that should not have any policy applied. So if someone who previously had a policy applied, moving them to the LEGALHOLD distribution group should clear that policy. I was told by a colleague to configure like so with the "$null" parameter:

Get-DistributionGroupMember "LEGALHOLD" -ResultSize unlimited | Set-Mailbox -ManagedFolderMailboxPolicy "$null" -ManagedFolderMailboxpolicyAllowed

That will spit out the following error:

Set-Mailbox : Cannot bind parameter 'ManagedFolderMailboxPolicy'. Cannot conve
t value "" to type "Microsoft.Exchange.Configuration.Tasks.MailboxPolicyIdPara
eter". Error: "The parameter value of this type Microsoft.Exchange.Configurati
n.Tasks.MailboxPolicyIdParameter cannot be empty.
Parameter name: identity"
At C:\Scripts\AssignRetentionPolicy\AssignRetentionPolicy.ps1:14 char:104
+ Get-DistributionGroupMember "LEGALHOLD" -ResultSize unlimited | Set-Mailbox
ManagedFolderMailboxPolicy <<<< "$null" -ManagedFolderMailboxPolicyAllowed
+ CategoryInfo : InvalidArgument: (:) [Set-Mailbox], ParameterBin
+ FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.Exchang

Obviously $null doesn't work. Any suggestions?

tfd6412 -> RE: Issue removing managed folder MB policy via script (2.Mar.2012 2:04:38 PM)

It appears the quotes around "$null" are the problem.


Get-DistributionGroupMember "LEGALHOLD" -ResultSize unlimited | Set-Mailbox -ManagedFolderMailboxPolicy $null -ManagedFolderMailboxPolicyAllowed


Page: [1]