I am able to use the following command to set a mailbox retention to $null (Example 1:). However when I try to do a bulk set (Example 2) the command executes but it does not set the Retention Policy to $NULL. Instead it displays the following on the screen
. WARNING: The command completed successfully but no settings of "user name’ have been modified
Example 1
Set-Mailbox John -RetentionPolicy $Null
Example 2
$UserMailboxes = Get-Mailbox -Filter {(RecipientTypeDetails -eq ‘UserMailbox’)} $UserMailboxes | Set-Mailbox –RetentionPolicy $Null
Any advise as to why it might not work in bulk mode or something wrong with the syntax.
Hey Marl,
At first glance, just looks like you a new line.
Instead of : $UserMailboxes = Get-Mailbox -Filter {(RecipientTypeDetails -eq ‘UserMailbox’)} $UserMailboxes | Set-Mailbox –RetentionPolicy $Null
Use -
$UserMailboxes = Get-Mailbox -Filter {(RecipientTypeDetails -eq ‘UserMailbox’)}
$UserMailboxes | Set-Mailbox –RetentionPolicy $Null
Or Alternatively -
Get-Mailbox -Filter {(RecipientTypeDetails -eq ‘UserMailbox’)} | Set-Mailbox –RetentionPolicy $Null
Can you try that?
Thank you for the information. I checked everything is morning and all the retention policies were set.
I did not get a chance to run your script but it does look correct from my knowledge of powershell.
FYI: As I was writing this response to you I had MS call me and informed me that the error message was normal. They said in the backend the changes were made and there was nothing else to change.
I guess the Exchange GUI was not displaying it correctly (mostly a timing issue).