PowerShell Random Password Generator

On a project earlier this year, I had to create random passwords for user accounts as part of a provisioning tool.  Perpetually trying to find the fastest way to do something, I came up with a one-liner that you can use to create a random text string from the following ASCII printable characters:


To create the passwords, I use this bit of magic:

PS> $Password = ([char[]]([char]33..[char]95) + ([char[]]([char]97..[char]126)) + 0..9 | sort {Get-Random})[0..8] -join ''
PS> $Password
[ Continue reading ]

Create a Transport Rule to Reject a Message When Both Domain Conditions Are Met

Today, I saw a question come up as to how to block a message when it’s sent to two different classes of users at the same time.  Let’s say you want to be able to send to,, and (list 1) or to,, and (list 2), but any time those users from both list 1 AND list 2 appear in the To/CC of the *same* email message, you want it to be blocked. … [ Continue reading ]