Find a Mail Flow Rule Using the Transport Rule ID

Your message to user@domain.com couldn’t be delivered. A custom mail flow rule created by an admin at domain.com has blocked your message. <more stuff here> More Info for Email AdminsStatus code: 550 5.7.1_ETR This error occurs because an email admin at domain.com has created a custom mail flow rule that has blocked the sender’s message. It would be great if these NDRs would tell you […]

Read Me Leave comment

Two Ways to Export a List of Microsoft 365 Group Members

It’s easy to find instructions for exporting an Outlook Contact Group to a csv file, but there’s no built in way (as of today, at least) for an end user to export the membership of a Microsoft 365 (Office 365) Group. Here are two ways it can be done, one for an Exchange Administrator via PowerShell and one for an end user via Microsoft Outlook. […]

Read Me 2 Comments

Sharepoint Online Powershell Module on an Exchange Server

I have a massive Powershell script that performs end user service provisioning across a number of on-premises and Microsoft 365 services. Recently, I needed to add some code for setting security options for Sharepoint sites hosted on Sharepoint Online. Since the original purpose of this script was to provision and configure Exchange mailboxes, it runs within the Exchange Management Shell. It turns out that this […]

Read Me Leave comment

Find and Unhide all Hidden Files Using PowerShell

This PowerShell one-liner will find all hidden files and folders in the current directory and turn off the Hidden attribute: Get-ChildItem -Force -Recurse | Where-Object{($_.Attributes.ToString().Split(“, “) -contains “Hidden”) -and ($_.Name -ne “thumbs.db”) -and ($_.Name -notlike “~*”) -and ($_.Name -ne “desktop.ini”) -and ($_.Name -ne “folder.ico”)} | foreach {$_.Attributes = “Archive”} I deliberately wrote this to skip thumbs.db, desktop.ini, folder.ico and Microsoft Office temporary files, because there […]

Read Me 2 Comments

Use PowerShell to Get a List of Users on Windows 7

You can use PowerShell to get a list of local workstation user accounts on Windows 7 or Windows 10. (Probably Windows 8 and 8.1, but does anybody really care?) This is much easier on Windows 10, than on 7. Get-LocalUser | Select Name Not much to write about there, but most of us still have some Windows 7 computers floating around, and that won’t work […]

Read Me Leave comment

Add Blocked Senders to Exchange Online Using PowerShell

Many things in Exchange and Office 365 take too long to do via the admin console, but are too obscure to do routinely via PowerShell. Unless, that is, you have a script! This function will add a single sender address to your spam policy’s BlockedSenders attribute or a sender domain to the BlockedSenderDomains attribute. (If you find any errors in the code below, let me […]

Read Me 3 Comments

Create Inbox Rules in PowerShell

Let’s say you want to create in Inbox Rule and you don’t want to (or can’t) use Outlook to do it. Who cares why, right? You just don’t. $ReasonsWhy = “Not Relevant” You can use the New-InboxRule to move, copy, delete, forward, classify…whatever…newly received messages, just like you can if you created the rule through Outlook’s wizard. You can’t do quite everything in PowerShell that can be done […]

Read Me Leave comment