O365: Delete specific email from sender to mailboxes

Here’s a PowerShell script that uses the Exchange Online PowerShell module to delete a specific email from multiple mailboxes. This script searches for an email with the specified subject line sent from the specified sender and deletes it. Before running the script, ensure you have the Exchange Online PowerShell module installed and have the necessary permissions to search and delete […]

Read more

Connect to O365 v2 (EXO v2)

In order to Connect to O365 (EXO v2) using modern authentication you will need to install and import the EXO v2 module. ***PowerShell needs to have TLS 1.2 enabled in order to run EXO v2*** Run this in PowerShell:   [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 Install-Module -Name ExchangeOnlineManagement -Force If you have this module already installed, then you just need to import it […]

Read more

How to Manage Microsoft Teams using PowerShell

Install the Teams PowerShell Module The first step in managing Teams via PowerShell is to install the Teams Cmdlets module.  Running PowerShell as an Administrator, you will need to run the following and allow install from the untrusted repo as well as installing the NuGet package: Install-Module -Name MicrosoftTeams Connect PowerShell to the Tenant The next step is to connect […]

Read more

Get a List of Shared Mailboxes Members and Permissions

If you want to get a list of members from an O365 shared mailbox using powershell, you can run either command to do so: Get-Mailbox “Shared Mailbox Name” | Get-MailboxPermission | where {$_.user.tostring() -ne “NT AUTHORITY\SELF” -and $_.IsInherited -eq $false} | Format-Table Identity, User, AccessRights –AutoSize OR Get-Mailbox “Shared Mailbox name” -ResultSize:Unlimited | Get-MailboxPermission |Select-Object Identity,User,AccessRights | Where-Object {($_.user -like […]

Read more

Disable the Clutter feature in O365 mailboxes

To disabled the clutter feature in a user’s O365 mailbox run the following command:   Turn off Clutter for single user Get-Mailbox –identity someone@somewhere.com | Set-Clutter -enable $false    OR   Single mailbox: Set-Clutter -Identity <user name> -Enable $false      If you want to disable this feature for all users in your tenant as an admin, you can do this with […]

Read more

Delete all Calendar events from a mailbox

Connect to O365 using powershell first   Open PowerShell or EMS If this is an O365 mailbox, you will need to connect to the O365 environment Connect to Exchange On-line From the PowerShell console on an Exchange 2010 server: $Cred = Get-Credential  $s = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell -Credential $cred -Authentication Basic –AllowRedirection  Import-PSSession $s    Then run this command in powershell: Search-Mailbox -identity “UsersMailbox” -SearchQuery kind:meetings -DeleteContent   

Read more

How to copy old user’s mailbox to another user’s mailbox on Office 365 and Exchange Server using PowerShell

You will come across the issue with leavers mailboxes needing to be transferred to another users mailbox. If you are looking after on-site exchange, then the process is slightly shorter as you don’t need to connect to the remote Powershell.   To connect to O365 first run this PS command: $Cred = Get-Credential  $s = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell -Credential $cred -Authentication Basic […]

Read more

Bulk import email aliases to Office 365 using Powershell

If you need to add email aliases to O365 accts in bulk use the following (EMS) powershell command with the CSV file formatted this way:   Name ProxyAddresses user1@domainold.com user1@domainnew.com   Run this in EMS: Import-Csv C:\email-aliases.csv | ForEach-Object{ $name = $_.Name }  Import-Csv C:\email-aliases.csv | ForEach-Object{ $proxy = $_.ProxyAddresses -split ‘;’}  Set-RemoteMailbox -Identity $name -EmailAddresses @{add= $proxy}    OR   Get the display name and email […]

Read more

Enable Litigation Hold for all Mailboxes in Office 365

There’s no built-in feature at this time to enable litigation hold for all mailboxes in Exchange Online, but some organisations have this as a requirement. Here’s a script that can be run ad-hoc to enable litigation hold for all mailboxes. When prompted, enter your Exchange Online credentials.   # Connect to Exchange Online $exo = New-PSSession -ConfigurationName Microsoft.Exchange ` -ConnectionUri https://ps.outlook.com/powershell-liveid […]

Read more
1 2 3