Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
# run [Exchange Management Shell]
PS C:\Windows\system32> LaunchEMS
# create database for archives
[PS] C:\Windows\system32> New-MailboxDatabase -Server rx-7 -Name "Archive Database 001" `
-EdbFilePath "C:\Program Files\Microsoft\Exchange Server\V15\Mailbox\Archive Database\Archive Database 001.edb" `
-LogFolderPath "C:\Program Files\Microsoft\Exchange Server\V15\Mailbox\Archive Database"
Name Server Recovery ReplicationType
---- ------ -------- ---------------
Archive Database 001 RX-7 False None
WARNING: Please restart the Microsoft Exchange Information Store service on server RX-7 after adding new mailbox databases.
# mount database
[PS] C:\Windows\system32> Mount-Database "Archive Database 001"
[PS] C:\Windows\system32> Get-MailboxDatabase
Name Server Recovery ReplicationType
---- ------ -------- ---------------
Mailbox Database 1217118174 RX-7 False None
Archive Database 001 RX-7 False None
[PS] C:\Windows\system32> Restart-Service MSExchangeIS
WARNING: Waiting for service 'Microsoft Exchange Information Store (MSExchangeIS)' to start...
# for example, enable Archive for [Server World] user
[PS] C:\Windows\system32> Enable-Mailbox "Server World" -Archive -ArchiveDatabase "Archive Database 001"
Name Alias ServerName ProhibitSendQuota
---- ----- ---------- -----------------
Server World Serverworld rx-7 4.5 GB (4,831,838,208 bytes)
[PS] C:\Windows\system32> Get-Mailbox "Server World" | Select Name,ArchiveDatabase
Name ArchiveDatabase
---- ---------------
Server World Archive Database 001
# test connection to Archive database
[PS] C:\Windows\system32> Test-ArchiveConnectivity -UserSmtp serverworld@srv.world
RunspaceId : 453cac6d-80d5-4bb2-9cbb-a0570ce1e8ac
Identity : serverworld@srv.world
PrimaryMRMConfiguration :
PrimaryLastProcessedTime :
ArchiveDomain :
ArchiveDatabase : Archive Database 001
ArchiveMRMConfiguration :
ArchiveLastProcessedTime :
ComplianceConfiguration : ElcV2, ValidArchiveDatabase
ItemMRMProperties :
Result : Successfully logged on to the users Archive mailbox.
Error :
IsValid : True
ObjectState : New
# display users Archive is disabled
[PS] C:\Windows\system32> Get-Mailbox -Filter "Name -NotLike 'DiscoverySearchMailbox*' -AND ArchiveDatabase -Eq `$null" | Select Name,ArchiveDatabase
Name ArchiveDatabase
---- ---------------
Exchange Admin
Ubuntu Linux
CentOS Linux
Fedora Linux
RedHat Linux
Debian Linux
# for the case it enables Archive to all disabled users, run like follows
[PS] C:\Windows\system32> Get-Mailbox -Filter "Name -NotLike 'DiscoverySearchMailbox*' -AND ArchiveDatabase -Eq `$null" | Enable-Mailbox -Archive -ArchiveDatabase "Archive Database 001"
[PS] C:\Windows\system32> Get-Mailbox -Filter "Name -NotLike 'DiscoverySearchMailbox*'" | Select Name,ArchiveDatabase
Name ArchiveDatabase
---- ---------------
Server World Archive Database 001
Exchange Admin Archive Database 001
Ubuntu Linux Archive Database 001
CentOS Linux Archive Database 001
Fedora Linux Archive Database 001
RedHat Linux Archive Database 001
Debian Linux Archive Database 001
# for the case it disables Archive to a user, run like follows
[PS] C:\Windows\system32> Disable-Mailbox "CentOS Linux" -Archive
Confirm
Are you sure you want to perform this action?
Disabling the archive for "CentOS Linux" will remove the archive for this user and mark it in the
database for removal.
[Y] Yes [A] Yes to All [N] No [L] No to All [?] Help (default is "Y"): Y
|