Showing posts with label Microsoft Exchange. Show all posts
Showing posts with label Microsoft Exchange. Show all posts

18 August 2024

Add a block entry to the Exchange Online Tenant Allow/Block List

Exchange Online PowerShell:

New-TenantAllowBlockListItems -ListType Sender -Block -NoExpiration -Entries badperson@example.com -Notes "My description"

Add entries to a user's Outlook Trusted and Blocked senders

To add "contoso.com" and "fabrikam.com" to jsmith@example.com's Outlook Trusted Senders list, and add "jane@adatum.com" to their Blocked Senders list, without affecting existing entries:

Set-MailboxJunkEmailConfiguration -Identity jsmith@example.com -TrustedSendersAndDomains @{Add="contoso.com","fabrikam.com"} -BlockedSendersAndDomains @{Add=jane@adatum.com}

To view the user's list of Trusted Senders:

(Get-MailboxJunkEmailConfiguration jsmith@example.com).TrustedSendersAndDomains

And to view Blocked Senders:

(Get-MailboxJunkEmailConfiguration jsmith@example.com).BlockedSendersAndDomains

Remove a list of domains from all users' Outlook Blocked Senders list

From Exchange PowerShell:

# For every user mailbox, remove blocked senders with domains in $approvedDomainList $approvedDomainList = "gooddomainexample1.com","gooddomainexample2.com","gooddomainexample3" $user= Get-Mailbox -ResultSize unlimited -Filter {(RecipientTypeDetails -eq 'UserMailbox')} | Select Identity $user | ForEach-Object { if ($blockedDomains = ($_ | Get-MailboxJunkEmailConfiguration).BlockedSendersAndDomains | Where-Object {$_.Split('@')[1] -in $approvedDomainList}) { $_ | Set-MailboxJunkEmailConfiguration –BlockedSendersAndDomains @{remove=$blockedDomains} Write-Host "Removed the following address(es) from {0}'s blocked list:`n`t{1}" -f $_.Name,($blockedDomains -join "`n`t") } }

15 April 2022

Change Exchange calendar permissions via command line

Get a user's current calendar permissions:

Get-MailboxFolderPermission -Identity abc@example.com:\Calendar

Give another user PublishingEditor permissions:

Add-MailboxFolderPermission -Identity abc@example.com:\Calendar -User xyz@example.com -AccessRights PublishingEditor

Remove a user's permissions from the calendar:

Remove-MailboxFolderPermission -Identity abc@example.com:\Calendar -User xyz@example.com

17 July 2021

Decommissioning Exchange server in hybrid configuration

Remove the intra-organisation connector:

Remove-IntraOrganizationConnector -Identity "HybridIOC - [ID]"

Get mailboxes without email address policy applied

Get-Mailbox | Where {$_.EmailAddressPolicyEnabled -eq $false}

28 January 2019

Check progress of an Exchange mailbox move request

Get-MoveRequestStatistics -Identity jbloggs@example.com -IncludeReport |fl

Perform an Exchange Discovery Seach

  1. Use an account that has been assigned the Discover Management role and has its own mailbox.

  2. Create a new Discovery mailbox which will hold the results of the search (in a subfolder):

    New-Mailbox -Name MyDiscoverSearchResultsMailbox -Discovery

  3. EAC > Compliance Management > in-please eDiscovery & hold > + new search

  4. Grant access permission for the user who'll access the search results mailbox:

    Add-MailboxPermission "MyDiscoverSearchResultsMailbox" -User "Joe Bloggs" -AccessRights FullAccess -InheritanceType all

Ta, Microsoft.

29 October 2017

Search message tracking logs in Exchange 2013+

Because having a GUI would be too easy, use the EMC to search message logs in recent versions of Exchange.

An example of searching for emails FROM bill@microsoft.com, from 25 Oct 2016 to 27 Oct 2016, outputting to a file:

Get-MessageTrackingLog -ResultSize Unlimited -Start "10/25/2016" -End "10/27/2016" -Sender "bill@microsoft.com" | Select-Object Timestamp,SourceContext,Source,EventId,MessageSubject,Sender,@{Name="Recipients";Expression={$_.Recipients}} | Export-CSV C:\temp\MessageLogResults.txt

(Note that it seems to force you to use the United States date notation.)

Searching for emails TO bill@microsoft.com, from 25 Oct 2016 to 27 Oct 2016, outputting to a file:

Get-MessageTrackingLog -ResultSize Unlimited -Start "10/25/2016" -End "10/27/2016" -Recipients "bill@microsoft.com" | Select-Object Timestamp,SourceContext,Source,EventId,MessageSubject,Sender,@{Name="Recipients";Expression={$_.Recipients}} | Export-CSV C:\temp\MessageLogResults.txt

It's also the only way to search using a wildcard in older versions of Exchange.

24 March 2016


If you expect an answer, Microsoft, ask a fucking question.

20 March 2016

List Exchange users that are (or have) delegates

Use this command:

ldifde -f delegates.txt -d "ou=Users,dc=domain,dc=com" -l name,publicDelegates,publicDelegatesBL -r "(|(publicDelegates=*)(publicDelegatesBL=*))"

Cheers, William Lefkovics.

27 April 2013

Perform wildcard search on Exchange Message Tracking logs

Need to do a wildcard search on Exchange's tracking logs? Microsoft couldn't be bothered including such a basic ability in the console. Instead you're forced to use the Exchange Management Shell. Sigh.

Edit this command as you need:

Get-MessageTrackingLog -ResultSize Unlimited -Start "1/5/2013" -End "1/6/2013" | where{$_.recipients -like "*@example.com"} | select-object Timestamp,SourceContext,Source,EventId,MessageSubject,Sender,{$_.Recipients} | export-csv C:\ExchangeLogResults.txt

Props, Toaster Gremlin.

Give administrator access to all mailboxes in Exchange 2003

By default, Administators are denied access to mailboxes in Exchange 2003. You can fix that with these steps:
  1. In Exchange System Manager, right-click on the server and select Properties.
  2. Hit the Security tab, then Advanced button.
  3. Untick the "allow inheritable permissions" box, then hit Copy.
  4. Now remove the deny entries.

Snaps to PowerBiz Solutions.