Sunday, 30 March 2008

Top 10 Exchange administration tasks using Power Shell

# Mailbox User
# input password such as: "Mypassword=01"
$pass = new-SecureString new-Mailbox -alias "testmailboxuser" -name MailboxUser -password $pass -database db1 -org users

# Conference Room Mailbox
New-Mailbox -alias testconfmbx -name ConfMailbox -database db1 -org users -resourceType Room

# Equipment Mailbox
New-Mailbox -alias testequpmbx -name EquipMailbox -database db1 -org users -resourceType Equipment

# Mail Enabled Universal Distribution Group
new-distributiongroup -alias testdisgroup -name MailEnabledUniversalDistributionGroup -type distribution -org users

# Mail Enabled Universal Security Group
new-distributiongroup -alias testsecgroup -name MailEnabledUniversalSecurityGroup -type security -org users # Mail Enabled Dynamic Distribution Groupnew-DynamicDistributionGroup -alias testddl -name QuerybasedDistributionGroup -recipientfilter {Company -eq "foo"} -org users

# Mail Enabled Contact
new-mailcontact -alias testcontact -name MailEnabledContact -ExternalEmailAddress contact@foo.com -org users

# Shared Mailbox
new-Mailbox -alias testsharedmbx -name SharedMailbox -database db1 -org users -shared

# Linked Mailbox
New-Mailbox -alias testlinkmbx -name LinkedMailbox -database db1 -org users -LinkedMasterAccount account@foo.com -LinkedDomainController

Adds a disclaimer to all message sent from the mailbox Brettjo@fabrikam.com
$ConditionArray = Get-TransportRulePredicate $Condition = @($ConditionArray[0])
$Condition[0].addresses = get-mailbox Brettjo@fabrikam.com
$ActionArray = Get-TransportRuleAction
$Action = @($ActionArray[14])
$Action[0].Text = "Test disclaim message for one liner"
New-TransportRule "newrule" -Conditions $condition -Actions $action

Gives the user account Brettjo the right to create items in the public folder Finance Public Folder.
Add-PublicFolderPermission "Finance Public Folder" -User Brettjo -AccessRights "CreateItems"
Checks the mount status for all mailbox databases.

Get-MailboxDatabase -status fl Name,Mounted

Disables the Out of Office feature for external email.

get-MailboxDatabase "Finance Mailbox Database" set-mailbox -ExternalOOF InternalOnly


With thanks to Brettjo for his help

No comments: