The first cmdlet should be Get-Mailbox, not Set-Mailbox
Get-Mailbox $user | Where-Object { $_.LitigationHoldEnabled -eq $True } |Set-Mailbox -LitigationHoldEnabled $False
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi,
I am trying the delete litigation hold from several thousand Office 365 accounts. I have a .csv that only has one column and it contains the email addresses of those that I want to remove litigation hold from.
I was trying to use this script
Connect-ExchangeOnline
$csv=Import-CSV -Path "C:\Litcsv.csv"
ForEach ($user in $csv)
{
Set-Mailbox $user | Where-Object { $_.LitigationHoldEnabled -eq $True } |Set-Mailbox -LitigationHoldEnabled $False
}
However I am getting this error:
Any help is appreciated. Thanks in advance.
The first cmdlet should be Get-Mailbox, not Set-Mailbox
Get-Mailbox $user | Where-Object { $_.LitigationHoldEnabled -eq $True } |Set-Mailbox -LitigationHoldEnabled $False