Extract total mailbox count using PowerShell

 Extract total mailbox count using PowerShell


Steps 

1. Login to exchange online PowerShell

2. Run below mentioned commands to extract total count for respective mailbox type.


User Mailbox


(Get-Recipient -RecipientTypeDetails usermailbox -ResultSize Unlimited).count


Shared Mailbox


(Get-Recipient -RecipientTypeDetails sharedmailbox -ResultSize Unlimited).count


How to clean Teams application cache

How to clean Teams application cache


Steps 

Directory – 1


1. If Teams application is still running, right-click the Teams icon in the taskbar, and then select Quit.

2. Open the Run dialog box by pressing the Windows logo key + R.

3. In the Run dialog box, enter “%appdata%\Microsoft\Teams”, and then select OK.

4. Delete all files and folders in the “%appdata%\Microsoft\Teams” directory.


Directory - 2


1. Open the Run dialog box by pressing the Windows logo key + R.

2. In the Run dialog box, enter “C:\Users\%username%\AppData\Local\Packages\”, and then select OK.

3. Delete all files and folders in the C:\Users\%username%\AppData\Local\Packages\MSTeams_8wekyb3d8bbwe directory.


Final


1. Restart Teams.

 

Calendar Diagnostic Logs

Get-CalendarDiagnosticObjects -Identity user1@xyz.com -StartDate "2026-02-01" -EndDate "2026-02-28"

Convert SSL certificate from PFX to PEM (OpenSSL)

Install OpenSSL
Open PowerShell and cd to OpenSSL install location - 

C:\Program Files\OpenSSL-Win64\bin

Extract private key with password (encrypted) - 

.\openssl pkcs12 -in certificate.pfx -nocerts -out privatekey.pem

OR

Extract private key without password (unencrypted) - 

.\openssl rsa -in privatekey.pem -out privatekey-nopass.pem

Extract certificate - 

.\openssl pkcs12 -in certificate.pfx -clcerts -nokeys -out certificate.pem

Combine Certificate and Private key (if required) - 

Get-Content privatekey_unencrypted.pem, certificate.pem | Set-Content fullcertificate.pem

Universal Bulk Script

$ids = Get-Content C:\New_Folder\123.txt | Where-Object { $_ -match '\S' }

$ids | ForEach-Object { Get-Mailbox -Identity $_ } |Select-Object PrimarySmtpAddress, RecipientTypeDetails |Export-Csv C:\New_Folder\checkmailbox-type.csv -NoTypeInformation -Encoding UTF8