Wednesday, 2 July 2008
How to generate HTML reports with the Exchange Management Shell (EMS)
Get-MailboxStatistics | Select DisplayName, ItemCount | Sort ItemCount | ConvertTo-HTML –Property DisplayName, ItemCount >C:\report.htm
How to increas size of Signature in OWA
You can create the key as a DWORD. The default decimal value is 4096 (4KB) and the max is 16672 (16KB).
It must go on the back-end server.
This will set it to the maximum value of 16KB:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MSExchangeWeb\OWA]
"SignatureMaxLength"=dword:00004120
It must go on the back-end server.
This will set it to the maximum value of 16KB:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MSExchangeWeb\OWA]
"SignatureMaxLength"=dword:00004120
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
# 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
Thursday, 13 March 2008
Exchange 2007 Powershell Export - Import PST Files
Export/Import to PST Requirements
In order to export or import mailboxes to PST files the following requirements must be met:
1) Export/Import to PST must be run from a 32 bit client machine with Exchange Management Tools installed (Version Exchange 2007 SP1 or later). The 32bit requirement comes from a dependency with the Outlook client.
2) Either Outlook 2003 or Outlook 2007 must be installed on the client machine.
3) The user running the task must be an Exchange Organization Admin or an Exchange Server Admin on the server where the mailbox to export/import lives.
Export a mailbox to a PST File
Export-Mailbox -Identity ALIAS-PSTFolderpath C:\
This will export a PST file to the path specified and name that pst as the alias
Import is much the same
Import-Mailbox -Identity ALIAS-PSTFolderpath C:\
To export all mailboxes to pst files the following commands are used
Get-Mailbox -Database MYDB Export-Mailbox -PSTFolderPath D:\PSTs
Mailboxes can also be exported to PST files via a scheduled task.
Running a scheduled task is a two step process:
1) Create the powershell script and save it as a .ps1 file.
get-mailbox export-mailbox -PSTFolderPath C:\ -Confirm:$false
1b) OR
get-mailbox -server exchangemail -resultsize unlimited export-mailbox -pstfolderpath Z:\ -baditemlimit 1000 -maxthreads 15 -confirm:$false
2) Create the scheduled task to run powershell and load the exchange snappin; then run your script. The action of your scheduled task should look like:
powershell.exe -PSConsoleFile "C:\Program Files\Microsoft\Exchange Server\Bin\ExShell.psc1" -Command ". 'C:\script.ps1'"
A common Exchange Administrator task for might also be the extraction into a PST from a mailbox that is a Recovery Storage Group (RSG) for legal or compliance.
Exporting content directly from a RSG database to a PST file is not supported. To accomplish this task you'd have to first restore the mailbox content to an online mailbox using restore-mailbox and then export the online mailbox to a PST.
You could for example create a new mailbox to hold the recovered content and only grant access to it to the legal department; then export its contents to a PST file. To restore an RSG mailbox to a "different" mailbox you only need to use two additional parameters:
Restore-Mailbox -Identity legalDepartmentMailbox -RSGDatabase "Recovery Storage Group\My Database" -RSGMailbox mailboxToRecover -TargetFolder "Recovered Content"
In order to export or import mailboxes to PST files the following requirements must be met:
1) Export/Import to PST must be run from a 32 bit client machine with Exchange Management Tools installed (Version Exchange 2007 SP1 or later). The 32bit requirement comes from a dependency with the Outlook client.
2) Either Outlook 2003 or Outlook 2007 must be installed on the client machine.
3) The user running the task must be an Exchange Organization Admin or an Exchange Server Admin on the server where the mailbox to export/import lives.
Export a mailbox to a PST File
Export-Mailbox -Identity ALIAS
This will export a PST file to the path specified and name that pst as the alias
Import is much the same
Import-Mailbox -Identity ALIAS
To export all mailboxes to pst files the following commands are used
Get-Mailbox -Database MYDB Export-Mailbox -PSTFolderPath D:\PSTs
Mailboxes can also be exported to PST files via a scheduled task.
Running a scheduled task is a two step process:
1) Create the powershell script and save it as a .ps1 file.
get-mailbox export-mailbox -PSTFolderPath C:\ -Confirm:$false
1b) OR
get-mailbox -server exchangemail -resultsize unlimited export-mailbox -pstfolderpath Z:\ -baditemlimit 1000 -maxthreads 15 -confirm:$false
2) Create the scheduled task to run powershell and load the exchange snappin; then run your script. The action of your scheduled task should look like:
powershell.exe -PSConsoleFile "C:\Program Files\Microsoft\Exchange Server\Bin\ExShell.psc1" -Command ". 'C:\script.ps1'"
A common Exchange Administrator task for might also be the extraction into a PST from a mailbox that is a Recovery Storage Group (RSG) for legal or compliance.
Exporting content directly from a RSG database to a PST file is not supported. To accomplish this task you'd have to first restore the mailbox content to an online mailbox using restore-mailbox and then export the online mailbox to a PST.
You could for example create a new mailbox to hold the recovered content and only grant access to it to the legal department; then export its contents to a PST file. To restore an RSG mailbox to a "different" mailbox you only need to use two additional parameters:
Restore-Mailbox -Identity legalDepartmentMailbox -RSGDatabase "Recovery Storage Group\My Database" -RSGMailbox mailboxToRecover -TargetFolder "Recovered Content"
Exchange 2007 Powershell Disconnected Mailbox
Remove Disconnected Mailboxes in Exchange 2007
List all Disconnected Mailboxes
Get-MailboxStatistics | where-object { $_.DisconnectDate -ne $null } | Select DisplayName,MailboxGuid
Remove single mailbox
Remove-Mailbox -Database -StoreMailboxIdentity -confirm:$false
Remove all at the same time
$users = Get-MailboxStatistics | where-object { $_.DisconnectDate -ne $null } | Select DisplayName,MailboxGuid
Remove from all databases:
$users = Get-MailboxStatistics | where-object { $_.DisconnectDate -ne $null } | Select DisplayName,MailboxGuid,Database
$users | ForEach { Remove-Mailbox -Database $_.Database -StoreMailboxIdentity $_.MailboxGuid -confirm:$false }
List all Disconnected Mailboxes
Get-MailboxStatistics | where-object { $_.DisconnectDate -ne $null } | Select DisplayName,MailboxGuid
Remove single mailbox
Remove-Mailbox -Database
Remove all at the same time
$users = Get-MailboxStatistics | where-object { $_.DisconnectDate -ne $null } | Select DisplayName,MailboxGuid
Remove from all databases:
$users = Get-MailboxStatistics | where-object { $_.DisconnectDate -ne $null } | Select DisplayName,MailboxGuid,Database
$users | ForEach { Remove-Mailbox -Database $_.Database -StoreMailboxIdentity $_.MailboxGuid -confirm:$false }
Tuesday, 11 March 2008
Lately I've been measuring......
Seems my time is growing thin...........
Wind me up and watch me spin. Watch me spin..................
I'm just skin and bones
Wind me up and watch me spin. Watch me spin..................
I'm just skin and bones
Subscribe to:
Posts (Atom)