Very useful when you have hundreds of folders in the user mailbox or shared mailbox, and you want to find a specific folder that was accidentally moved.
Import-Module ExchangeOnlineManagement
Connect-ExchangeOnline -UserPrincipalName <Enter your admin exchange admin or global admin credentials>
# Search for the folder
$folder = Get-MailboxFolderStatistics -Identity "enter the mailbox address" | Where-Object {$_.Name -eq $folderName}
# Check if the folder exists
if ($folder -ne $null) {
Write-Host "The folder '$folderName' is located at $($folder.FolderPath)"
} else {
Write-Host "The folder '$folderName' was not found."
}
# Disconnect from the mailbox
Remove-PSSession $session
No comments:
Post a Comment