krypted.com

Tiny Deathstars of Foulness

Before I type anything else, allow me to state that running a search and deleting things with a script from a users (or a loop of all users) is a very dangerous process. However, I’ve often noticed that an outbreak of bad things can cause us to do some pretty awesome things. So, you can use the get-Mailbox cmdlet to pipe a mailbox into the search-mailbox cmdlet and from there use the -SearchQuery option to search for an attachment, following the attachment option with a filename and then delete it using the -DeleteContent option. The example would be as follows:

Get-Mailbox -Identity “cedge” | Search-Mailbox -SearchQuery attachment:ichatsmileys.pkg.zip -DeleteContent

You can also filter search queries based on To, From, CC, Subject, Sent date and of course, policy data. You can also use the -TargetMailbox and -TargetFolder options to move messages into a quarantine mailbox/space.

January 3rd, 2014

Posted In: Microsoft Exchange Server, Network Infrastructure, Windows Server

Tags: , , , , , , ,

Find all mailboxes with Send As permissions for someone other than yourself with Exchange PowerShell using this command:

Get-Mailbox | Get-ADPermission | where {($_.ExtendedRights -like “*Send-As*”) -and -not ($_.User -like “NT AUTHORITYSELF”)} | FT -Wrap

April 3rd, 2007

Posted In: Active Directory, Microsoft Exchange Server

Tags: , , , , , ,

How many times do you go to create a user and find that it’s already there, or at least the forwarding address is.  Info@, sales@, etc.  Well, in Exchange 2007 you can final all the users with a forwarding address in them to quickly isolate who already has your address.  To do so, use the following command:

Get-Mailbox | Where {$_.ForwardingAddress -ne $null} | Select Name, ForwardingAddress, DeliverToMailboxAndForward

February 19th, 2007

Posted In: Microsoft Exchange Server

Tags: , , , ,