Friday, May 12, 2023

Powershell script to find a Folder location in outlook

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:

How to Install RSAT on Windows 11 - 23H2

 Run Powershell as Admin Change the following registry key that manages the Windows Update source. HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Micr...