Thus far, most of the examples have been for
managing mailbox resources. EMS can also be used to manage the Exchange
servers in your environment. The following example shows how to disable
a Unified Messaging server. This allows the administrator to start or
stop call processing on a Unified Messaging server so that the Unified
Messaging server can be brought online or taken offline in a controlled
way.
Disable-UMServer UMserver3
This example uses the Set-AttachmentFilterListConfig command to modify the configuration of the Attachment Filter agent on the computer running the Edge server role.
Set-AttachmentFilterListConfig -action remove
And in this example, the set-dsnmessage command is used to modify the configuration for delivery status notification (DSN) messages on Hub Transport and Edge servers.
set-dsnmessage en\internal\5.2.2 -text "The message you attempted to send could not
be delivered because the recipient's mailbox is full."
These
are just a few examples of what can be done with the Exchange
Management Shell. Many, many more commands are available to the
administrator.
Provisioning Storage Groups with EMS
Exchange
2007 storage groups can easily be provisioned, configured, and moved
using the Exchange Management Shell. This first example creates a new
storage group on SERVER3 called “Marketing Storage Group” with the logs
on the L: drive.
New-StorageGroup -Server SERVER3 -name "Marketing Storage Group" -LogFileLocation
"L:\Marketing Storage Group Logs"
The next example configures the “Test Storage Group 2” in Active Directory to enable circular logging:
Set-StorageGroup "Test Storage_Group_2" -CircularLoggingEnabled $true
Use the Move-StorageGroupPath
command to set a new path in Active Directory for the specified server
object and then move the related files to the new location.
Move-StorageGroupPath "Sales Storage Group" -LogFolderPath "L:\Sales Storage Group Logs"
–SystemFolderPath "E:\Exchange Databases\Sales"
Managing Mailbox Stores with EMS
All
facets of database administration can be handled with the Exchange
Management Shell. Using the following examples, mailbox stores can be
created, dismounted, and moved. The first example creates a new Sales
Database in the First Storage Group on SERVER2:
New-MailboxDatabase -StorageGroup "SERVER2\First Storage Group" -name "Sales Database"
The second example shows how to mount the same mailbox database after it has been created.
Mount-database "SERVER2\First Storage Group\Sales Database"
Use the move-DatabasePath
command to set a new path location on a database object in Active
Directory under the specified mailbox server and to move the related
files to that location.
move-DatabasePath "SERVER2\Sales Database" -LogFolderPath "E:\New Folder\Sales Database"
When the preceding command is run, EMS automatically takes the database offline, moves the database, and mounts it again.
The next example shows how to delete a mailbox database object in the storage group container under the specified server object.
Remove-MailboxDatabase "SERVER2\sales database"
When this command is run,
Exchange Management Shell deletes the database and provides a warning,
letting the administrator know that the database has been removed from
Active Directory but the physical files remain. You will get a warning
as follows:
WARNING: The specified database has been removed. You must remove the database file
from your computer manually. Specified database: Sales Database
Managing Connectors with EMS
All
types of connectors can be managed with the Exchange Management Shell.
Receive and Send connectors can be created, deleted, and configured.
This example gets the existing credential object and creates a new
secured Send connector on an Edge or Hub Transport server role and
configures it to use that credential:
$CredentialObject = Get-Credential
New-SendConnector -Name "Secure E-Mail to Companyabc.org" -Type ToInternet -AddressSpaces companyabc.com
-AuthenticationCredential $CredentialObject -AuthenticationMechanism Login
This example modifies an existing Receive connector. The Identity parameter is required when you are running the Set-ReceiveConnector
command. This example sets the number of hops from the Edge server,
sets the SMTP banner message, and configures the connection timeout
value:
Set-ReceiveConnector -Identity "Internet Receive Connector" -NumberOfHopsFromEdge 1
-Banner "220 Authorized access only" -ConnectionTimeout 00:15:00
This
command deletes the object and the configuration information for a
Receive connector. After this task completes, the object and the
configuration information for the Receive connector are deleted.
Remove-ReceiveConnector "Companyabc.com Receive Connector"