Category Archives: PowerShell

Powershell-Tastic!

On the back of some of the work i’ve done implementing Exchange 2007 recently, here are some vaguely useful powershell scripts!..

Change All mailbox Database settings
Having to apply new limits to databases etc can be a bit painful through the GUI. use this script to apply mailbox limits etc
80mb warning limit
100mb send prevention
35 day deleted item retendion
35day deleted mailbox retention

Get-MailboxDatabase -Server set-mailboxdatabase -IssueWarningQuota 80MB -ProhibitSendQuota 100MB -Prohibit SendReceiveQuota unlimited -DeletedItemRetention 35.00:00:00 -MailboxRetention 35.00:00:00 -RetainDeletedItemsUntilBackup:$true

Testing a server

These built in commands test the functionality of Exchange 2007, SCOM uses these for part of the manegement pack i think!

test-systemhealth
is a wrapper for ExBPA through the command shell, a good first point for call for testing

test-mapiconnectivity
tests MAPI access to all mailbox databases on the server

test-owaconnectivity
tests OWA access to a Client Acces Server, either run on a CAS server or specify in the syntax, you may also need to run new-testcasconnectivityuser.ps1 script to create the test account i.e
get-mailboxserver new-testcasconnectivityuser.ps1

test-mailflow
tests mailflow to and from a system mailbox on the server specified

test-servicehealth
A fast way to check the status of Exchange related services

Public Folder replication
There are a number of “builtin” scripts with Exchange 2007 that live in the \scripts folder in the exchange root
some useful ones

AddReplicaToPFRecursive.ps1
adds a server to a list of public folders and to its subfolders, I had some problems with this one, initially getting to to add a whole IPM_SUBTREE seemed a bit impossible. The script requires a top level folder parameter, but wouldn’t accept the root. which is a pain in organisations where they create all folders under the root. You can add folders explicitly, but this is painful if there are a lot!
if you specify “\” as the top level folder it appears to work…
Its a way of saving some effort, but I did find folders where replicas hadn’t been added and no errors reported so I added them manually…

get-publicfolderstatistics
get the list of public folders replicated to the server and theirs stats, useful to see if the list is approximately what it should be!