Today i was trying to search and delete an email from user's mailboxes in Exchange online/Office 365.
My steps were as below.
1: Connect-EXOPSSession -UserPrincipalName myadmin@mydomain.com
2:
$Search=New-ComplianceSearch -Name "Remove Phishing Message" -ExchangeLocation All -ContentMatchQuery '(Received:4/13/2016..4/14/2016) AND (Subject:"Action required")' Start-ComplianceSearch -Identity $Search.Identity
But were getting the following error
New-ComplianceSearch : The term 'New-ComplianceSearch' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Solution:
Run the following command to connect to "Security & Compliance Center PowerShell"
Connect-IPPSSession -UserPrincipalName khan.nawaz@pt.net.com
and after that is was able to run the New-ComplianceSearch command.
As per TechNet article this command is used to connect to Security & Compliance Center PowerShell or standalone Exchange Online Protection PowerShell using modern authentication. The cmdlet works for MFA or non-MFA enabled accounts.
For further detail:
Connect-IPPSSession (ExchangePowerShell) | Microsoft Docs
and
No comments:
Post a Comment