Disabling
or Removing Mailboxes with EMS
Disabling a
mailbox in Exchange Server 2010 removes the Exchange Server attributes
from a user in AD, making the AD user non-mail enabled. The AD user
account is otherwise untouched. The mailbox is truly deleted by Exchange
Server during the online maintenance cycle after exceeding the
retention time.
Removing a mailbox
in Exchange Server 2010 actually deletes the AD user account and
mailbox. Because most Exchange Server administrators might not have
rights to delete user accounts in AD, the most common Exchange Server
task is to disable the mailbox.
The following example
disables a mailbox of a user in the companyabc.com domain:
Disable-Mailbox companyabc\claire
The next example shows how
to delete all the mailboxes in the “Test Database” mail store so that it
can be decommissioned:
get-Mailbox -database "test database" | disable-Mailbox –whatif
The –WhatIf
switch in the preceding example runs the task in read-only mode,
allowing the administrator to see what would happen by running this
command.
The Remove-Mailbox cmdlet is used to remove the AD user account
associated with a mailbox, as shown in the following example:
Note
The administrator
requires user management rights in Active Directory to perform a
Remove-Mailbox task because this task deletes the Active Directory user.
Using EMS for
Server Tasks
Thus far, most of
the examples have been for managing mailbox resources. EMS can also
manage the Exchange servers in your environment. The following example
demonstrates how to disable a Unified Messaging server. This enables 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
The next 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 reject
And in this example, the Set-EventLogLevel cmdlet is used to set diagnostic logging for
the mailbox replication to high:
Set-EventLogLevel 'MSExchange Mailbox Replication\Service' -Level High
These are just a few
examples of what can be done with the Exchange Management Shell to
manage Exchange servers. Many, many more commands are available to the
administrator.
Provisioning
Databases with EMS
Exchange Server 2010 databases can easily be
provisioned and configured using the Exchange Management Shell. This
first example creates a new database called “Marketing Storage Group”:
New-MailboxDatabase -name "Marketing Storage Group" -EdbFilePath "D:\Database Files\Marketing Storage Group.edb"
The next example configures
circular logging on the “Test Database 2” database:
Set-MailboxDatabase -CircularLoggingEnabled $true -Identity "Test Database 2"
Managing Databases
with EMS
All facets of Exchange
Server 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:
New-MailboxDatabase -name "Sales Database" -EdbFilePath "D:\Program Files\Microsoft\Exchange Server\V14\Mailbox\Sales Database.edb"
The second example shows
how to mount the same mailbox database after it has been created:
Mount-database "Sales Database"
Use the Move-DatabasePath
command to set a new path in Active Directory for the database object
and then move the related files to the new location. For example:
move-DatabasePath -Identity 'MBDB1' -EdbFilePath 'D:\Program Files\Microsoft\Exchange Server\V14\Mailbox\MBDB1\MBDB1.edb'
-LogFolderPath 'D:\Program Files\Microsoft\Exchange Server\V14\Mailbox\MBDB1'
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:
Remove-MailboxDatabase "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. The
following warning is displayed:
WARNING: The specified database has been removed. You must remove the database file
located in DatabaseFilePath from your computer manually if it exists. 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
This example modifies
an existing Receive connector. The Identity parameter is required when
you are running the Set-ReceiveConnector command. This example sets the maximum number of hops, sets
the SMTP banner message, and configures the connection timeout value:
Set-ReceiveConnector -Identity "Internet Receive Connector" -MaxHopCount 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"