{"id":1241,"date":"2015-05-27T17:17:17","date_gmt":"2015-05-28T00:17:17","guid":{"rendered":"http:\/\/jim-zimmerman.com\/?p=1241"},"modified":"2017-09-14T16:00:23","modified_gmt":"2017-09-14T23:00:23","slug":"exchange-management-shell-commands-work-in-progress","status":"publish","type":"post","link":"https:\/\/jim-zimmerman.com\/?p=1241","title":{"rendered":"Exchange Management Shell Commands (work in progress)"},"content":{"rendered":"<p>This is more a reference for myself:<\/p>\n<p>I covered the basics of message tracking in:<br \/>\n<a href=\"http:\/\/jim-zimmerman.com\/?p=1098\" target=\"_blank\">http:\/\/jim-zimmerman.com\/?p=1098<\/a><\/p>\n<p>How to get the full Exchange version:<\/p>\n<blockquote><p>Get-Command ExSetup | Format-List<\/p><\/blockquote>\n<blockquote><p>Get-Command ExSetup | ForEach {$_.FileVersionInfo}<\/p><\/blockquote>\n<p>Here is a link to cross-reference the result to determine the service pack, etc.:<br \/>\n<a href=\"https:\/\/technet.microsoft.com\/en-us\/library\/hh135098(v=exchg.150).aspx\" target=\"_blank\">https:\/\/technet.microsoft.com\/en-us\/library\/hh135098(v=exchg.150).aspx<\/a><\/p>\n<p>Create a mailbox (and account):<\/p>\n<blockquote><p>New-Mailbox -Name &#8216;<em>FirstName LastName<\/em>&#8216; -Alias &#8216;<em>Username<\/em>&#8216; -OrganizationalUnit &#8216;<em>Oranizational Unit<\/em>&#8216; -UserPrincipalName &#8216;<em>Username@DOMAIN.NAME<\/em>&#8216; -SamAccountName &#8216;<em>Username<\/em>&#8216; -FirstName &#8216;<em>FirstName<\/em>&#8216; -Initials &#8221; -LastName &#8216;<em>LastName<\/em>&#8216; -Password &#8216;<em>TemporaryPassword<\/em>&#8216; -ResetPasswordOnNextLogon $false -Database &#8216;<em>MailboxDatabase<\/em>&#8216;<\/p><\/blockquote>\n<p>Database size:<\/p>\n<blockquote><p>Get-MailboxDatabase -Status | Select Name,DatabaseSize<\/p><\/blockquote>\n<p>PublicFolderDatabase size:<\/p>\n<blockquote><p>Get-PublicFolderDatabase -Status | Select Name,DatabaseSize<\/p><\/blockquote>\n<p>To determine role assignments:<\/p>\n<blockquote><p>Get-ManagementRoleAssignment<\/p><\/blockquote>\n<p>Create a recovery mailbox:<\/p>\n<blockquote><p>New-MailboxDatabase -Recovery -Name &#8220;Recovery DB Name&#8221; -Server EXCHANGESERVERNAME<\/p><\/blockquote>\n<p>To check mailbox stats:<\/p>\n<blockquote><p>Get-MailboxDatabase -Status | Format-List Mame,DatabaseSize,AvailableNewMailboxSpace<\/p><\/blockquote>\n<p>Delete a mailbox database.  Once removed, you can delete the files from the file system.:<\/p>\n<blockquote><p>Remove-MailboxDatabase -Identity &#8220;Recovery DB Name&#8221;<\/p><\/blockquote>\n<p>The right way to create a recovery database:<\/p>\n<blockquote><p>New-MailboxDatabase -Recovery -Name &#8220;Recovery DB Name&#8221; -Server EXCHANGESERVERNAME -EdbFilePath Drive:\\Directory\\Filename.edb -LogFolderPath Drive:\\Directory<\/p><\/blockquote>\n<p>Move a mailbox:<br \/>\nYou can use the canonical name of the object with the mailbox ( DOMAIN.LOCAL\/OU\/OU\/Name ) to move from EMS.<\/p>\n<p>Note: You may need to enable inheritance.  This can be dome from the ADUC.  Access the Properties for the user and click on Security tab.  If it is not visible, you need to enable your ADUC view for Advanced Features.  Once on the Security tab, click Advanced, and then down in the bottom left click &#8220;Enable inheritance&#8221;.  This is on a Windows 2012 R2 domain controller.  It might a little different dialog on older versions of Windows server.<\/p>\n<blockquote><p>[PS] >&#8217;DOMAIN.LOCAL\/TahityOU\/SurfingOU\/Cool Dude&#8217; | New-MoveRequest -TargetDatabase &#8216;My Exchange Database&#8217;<\/p>\n<p>DisplayName                                   Status                    TotalMailboxSize                              TotalArchiveSize                             PercentCompl<br \/>\n&#8212;&#8212;&#8212;&#8211;                                   &#8212;&#8212;                    &#8212;&#8212;&#8212;&#8212;&#8212;-                              &#8212;&#8212;&#8212;&#8212;&#8212;-                             &#8212;&#8212;&#8212;&#8212;<br \/>\nCool Dude                                     Queued                    5 B (5 bytes)                                                                              0\n<\/p><\/blockquote>\n<p>Check the status of all move requests:<\/p>\n<blockquote><p>[PS] >Get-MoveRequest<\/p><\/blockquote>\n<p>Check Cool Dude&#8217;s move request:<\/p>\n<blockquote><p>[PS] >Get-MoveRequest -Identity &#8216;cooldude@tahiti.surfing&#8217;<\/p><\/blockquote>\n<p>Nice, but what do I do to get all those canonical names?<br \/>\nThe following will give you all the canonical names for all objects in your domain.  From a domain controller, fire up powershell:<\/p>\n<blockquote><p>PS > Get-AdUser -Properties CanonicalName -Filter &#8216;*&#8217; | Select CanonicalName<\/p><\/blockquote>\n<p>I am sure there is a better way to do this, but this will give some output that will have the CanonicalName and Exchange mail server for an object.  You can work with this output to come with a list that of objects that need to be moved.<\/p>\n<blockquote><p>PS > Get-AdUser -Properties CanonicalName,msExchHomeServerName -Filter &#8216;*&#8217; | Select CanonicalName,msExchHomeServerName | Format-List<\/p><\/blockquote>\n<p>I have noticed that sometimes when I move a mailbox from one database to another and then I display mailbox statistics, I will have two different results for the same mailbox.  To find these, you need you use Get-MailboxStatistics and filter for MailboxState of SoftDeleted:<\/p>\n<blockquote><p>PS > Get-MailboxStatistics -server servername | Select DisplayName,DisconnectReason,Database | findstr &#8220;SoftDeleted&#8221;<\/p><\/blockquote>\n<p>And then to remove the SoftDeleted version of the mailbox:<\/p>\n<blockquote><p>PS > Remove-StoreMailbox -Identity &#8220;mailboxidentity&#8221; -Database &#8220;mailboxdatabase&#8221; -MailboxState SoftDeleted<\/p><\/blockquote>\n<p>If you have previously moved a mailbox and need to move it again, you will need to remove the old move request even though it is completed.  To do so:<\/p>\n<blockquote><p>PS> Remove-MoveRequest -Identity &#8216;Cool Dude&#8217;<\/p><\/blockquote>\n<p>This will create a Send Connector for use in your LAN.  In my case, it is a linux server.  Create a Send Connector:<\/p>\n<blockquote><p>New-SendConnector -Name &#8216;Some Name&#8217; -Usage &#8216;Internal&#8217; -AddressSpaces &#8216;SMTP:hostORdomainname;1&#8217; -IsScopedConnector $false -DNSRoutingEnabled $false -SmartHosts &#8216;[aaa.bbb.ccc.ddd]&#8217; -SmartHostAuthMechanism &#8216;None&#8217; -UseExternalDNSServersEnabled $false -SourceTransportServers &#8216;MY-EXCHG01&#8217;\n<\/p><\/blockquote>\n<p>Create a new mail contact:<\/p>\n<blockquote><p>New-MailContact -ExternalEmailAddress &#8216;SMTP:mycontact@email.address&#8217; -Name &#8216;mycontact&#8217; -Alias &#8216;mycontact&#8217; -FirstName &#8216;My&#8217; -Initials &#8216;MC&#8217; -LastName &#8216;Contact&#8217; -OrganizationalUnit &#8216;DOMAIN.LOCAL\/OU\/OU&#8217;<\/p>\n<\/blockquote>\n<p>To create and email box to an existing ADS account:<\/p>\n<blockquote><p>Enable-Mailbox -Identity &#8216;<em>DOMAIN.LOCAL\/OU\/ADSAccount<\/em>&#8216; -Alias &#8216;<em>myownalias<\/em>&#8216;<\/p><\/blockquote>\n<p>Enable a contact for a existing contact:<\/p>\n<blockquote><p>Enable-MailContact -Identity &#8216;<em>DOMAIN.LOCAL\/OU\/ContactName<\/em>&#8216; -ExternalEmailAddress &#8216;SMTP:my@external.emailaddress&#8217; -Alias &#8216;myAlias&#8217;<\/p><\/blockquote>\n<p>To check and make active components:<\/p>\n<blockquote><p>[PS] C:\\> Get-ServerComponentState<\/p>\n<p>Server                                  Component                               State<br \/>\n&#8212;&#8212;                                  &#8212;&#8212;&#8212;                               &#8212;&#8211;<br \/>\nVMEXCHG2013.greattechhelp.local         ServerWideOffline                       Inactive<br \/>\nVMEXCHG2013.greattechhelp.local         HubTransport                            Inactive<br \/>\nVMEXCHG2013.greattechhelp.local         FrontendTransport                       Inactive<br \/>\nVMEXCHG2013.greattechhelp.local         Monitoring                              Inactive<br \/>\nVMEXCHG2013.greattechhelp.local         RecoveryActionsEnabled                  Inactive<br \/>\nVMEXCHG2013.greattechhelp.local         AutoDiscoverProxy                       Inactive<br \/>\nVMEXCHG2013.greattechhelp.local         ActiveSyncProxy                         Inactive<br \/>\nVMEXCHG2013.greattechhelp.local         EcpProxy                                Inactive<br \/>\nVMEXCHG2013.greattechhelp.local         EwsProxy                                Inactive<br \/>\nVMEXCHG2013.greattechhelp.local         ImapProxy                               Inactive<br \/>\nVMEXCHG2013.greattechhelp.local         OabProxy                                Inactive<br \/>\nVMEXCHG2013.greattechhelp.local         OwaProxy                                Inactive<br \/>\nVMEXCHG2013.greattechhelp.local         PopProxy                                Inactive<br \/>\nVMEXCHG2013.greattechhelp.local         PushNotificationsProxy                  Inactive<br \/>\nVMEXCHG2013.greattechhelp.local         RpsProxy                                Inactive<br \/>\nVMEXCHG2013.greattechhelp.local         RwsProxy                                Inactive<br \/>\nVMEXCHG2013.greattechhelp.local         RpcProxy                                Inactive<br \/>\nVMEXCHG2013.greattechhelp.local         UMCallRouter                            Inactive<br \/>\nVMEXCHG2013.greattechhelp.local         XropProxy                               Inactive<br \/>\nVMEXCHG2013.greattechhelp.local         HttpProxyAvailabilityGroup              Inactive<br \/>\nVMEXCHG2013.greattechhelp.local         ForwardSyncDaemon                       Inactive<br \/>\nVMEXCHG2013.greattechhelp.local         ProvisioningRps                         Inactive<br \/>\nVMEXCHG2013.greattechhelp.local         MapiProxy                               Inactive<br \/>\nVMEXCHG2013.greattechhelp.local         EdgeTransport                           Inactive<br \/>\nVMEXCHG2013.greattechhelp.local         HighAvailability                        Inactive<br \/>\nVMEXCHG2013.greattechhelp.local         SharedCache                             Inactive<\/p><\/blockquote>\n<p>To make all your configured components active:<\/p>\n<blockquote><p>[PS] C:\\>Set-serverComponentState -Identity vmexchg2013 -Component ServerWideOffline -State Active  -Requester Functional\n<\/p><\/blockquote>\n<p>Check again:<\/p>\n<blockquote><p>[PS] C:\\> Get-ServerComponentState<br \/>\nServer                                  Component                               State<br \/>\n&#8212;&#8212;                                  &#8212;&#8212;&#8212;                               &#8212;&#8211;<br \/>\nVMEXCHG2013.greattechhelp.local         ServerWideOffline                       Active<br \/>\nVMEXCHG2013.greattechhelp.local         HubTransport                            Active<br \/>\nVMEXCHG2013.greattechhelp.local         FrontendTransport                       Active<br \/>\nVMEXCHG2013.greattechhelp.local         Monitoring                              Inactive<br \/>\nVMEXCHG2013.greattechhelp.local         RecoveryActionsEnabled                  Inactive<br \/>\nVMEXCHG2013.greattechhelp.local         AutoDiscoverProxy                       Active<br \/>\nVMEXCHG2013.greattechhelp.local         ActiveSyncProxy                         Active<br \/>\nVMEXCHG2013.greattechhelp.local         EcpProxy                                Active<br \/>\nVMEXCHG2013.greattechhelp.local         EwsProxy                                Active<br \/>\nVMEXCHG2013.greattechhelp.local         ImapProxy                               Active<br \/>\nVMEXCHG2013.greattechhelp.local         OabProxy                                Active<br \/>\nVMEXCHG2013.greattechhelp.local         OwaProxy                                Active<br \/>\nVMEXCHG2013.greattechhelp.local         PopProxy                                Active<br \/>\nVMEXCHG2013.greattechhelp.local         PushNotificationsProxy                  Active<br \/>\nVMEXCHG2013.greattechhelp.local         RpsProxy                                Active<br \/>\nVMEXCHG2013.greattechhelp.local         RwsProxy                                Active<br \/>\nVMEXCHG2013.greattechhelp.local         RpcProxy                                Active<br \/>\nVMEXCHG2013.greattechhelp.local         UMCallRouter                            Active<br \/>\nVMEXCHG2013.greattechhelp.local         XropProxy                               Active<br \/>\nVMEXCHG2013.greattechhelp.local         HttpProxyAvailabilityGroup              Active<br \/>\nVMEXCHG2013.greattechhelp.local         ForwardSyncDaemon                       Active<br \/>\nVMEXCHG2013.greattechhelp.local         ProvisioningRps                         Active<br \/>\nVMEXCHG2013.greattechhelp.local         MapiProxy                               Inactive<br \/>\nVMEXCHG2013.greattechhelp.local         EdgeTransport                           Active<br \/>\nVMEXCHG2013.greattechhelp.local         HighAvailability                        Active<br \/>\nVMEXCHG2013.greattechhelp.local         SharedCache                             Active\n<\/p><\/blockquote>\n<p>Enter Product License Key:<\/p>\n<blockquote><p>Set-ExchangeServer -Identity &#8216;MY-EXCHG01&#8217; -ProductKey &#8216;AAAAA-BBBBB-CCCCC-DDDDD-EEEEE&#8217;<\/p><\/blockquote>\n<p>List Services:<\/p>\n<blockquote><p>[PS] C:\\>Get-Service<\/p>\n<p>Status   Name               DisplayName<br \/>\n&#8212;&#8212;   &#8212;-               &#8212;&#8212;&#8212;&#8211;<br \/>\nStopped  AeLookupSvc        Application Experience<br \/>\nStopped  ALG                Application Layer Gateway Service<br \/>\nStopped  AllUserInstallA&#8230; Windows All-User Install Agent<br \/>\nRunning  AppHostSvc         Application Host Helper Service<br \/>\nStopped  AppIDSvc           Application Identity<br \/>\nStopped  Appinfo            Application Information<br \/>\nStopped  AppMgmt            Application Management<br \/>\nStopped  aspnet_state       ASP.NET State Service<br \/>\nStopped  AudioEndpointBu&#8230; Windows Audio Endpoint Builder<br \/>\nStopped  Audiosrv           Windows Audio<br \/>\nStopped  AxInstSV           ActiveX Installer (AxInstSV)<br \/>\nRunning  BackupExecAgent&#8230; Backup Exec Remote Agent for Windows<br \/>\nRunning  BackupExecAgent&#8230; Backup Exec Agent Browser<br \/>\nRunning  BackupExecDevic&#8230; Backup Exec Device &#038; Media Service<br \/>\nRunning  BackupExecJobEn&#8230; Backup Exec Job Engine<br \/>\nRunning  BackupExecManag&#8230; Backup Exec Management Service<br \/>\nRunning  BackupExecRPCSe&#8230; Backup Exec Server<br \/>\nRunning  bedbg              Backup Exec Error Recording Service<br \/>\n&#8230;<\/p><\/blockquote>\n<p>Find a service:<\/p>\n<blockquote><p>[PS] C:\\>Get-Service | findstr Inform<br \/>\nStopped  Appinfo            Application Information<br \/>\nRunning  MSExchangeIS       Microsoft Exchange Information Store\n<\/p><\/blockquote>\n<p>Restart and service:<br \/>\n[PS] C:\\>Restart-Service MSExchangeIS<br \/>\nWARNING: Waiting for service &#8216;Microsoft Exchange Information Store (MSExchangeIS)&#8217; to finish stopping&#8230;<br \/>\nWARNING: Waiting for service &#8216;Microsoft Exchange Information Store (MSExchangeIS)&#8217; to finish stopping&#8230;<br \/>\nWARNING: Waiting for service &#8216;Microsoft Exchange Information Store (MSExchangeIS)&#8217; to finish stopping&#8230;<br \/>\nWARNING: Waiting for service &#8216;Microsoft Exchange Information Store (MSExchangeIS)&#8217; to finish stopping&#8230;<br \/>\nWARNING: Waiting for service &#8216;Microsoft Exchange Information Store (MSExchangeIS)&#8217; to finish stopping&#8230;<br \/>\nWARNING: Waiting for service &#8216;Microsoft Exchange Information Store (MSExchangeIS)&#8217; to finish stopping&#8230;<br \/>\nWARNING: Waiting for service &#8216;Microsoft Exchange Information Store (MSExchangeIS)&#8217; to finish stopping&#8230;<br \/>\nWARNING: Waiting for service &#8216;Microsoft Exchange Information Store (MSExchangeIS)&#8217; to finish stopping&#8230;<\/p>\n<p>Check and Modify Role Memberships:<br \/>\nFirst, the &#8220;Organization Management&#8221; Role is the most powerful role in Exchange 2010 and Exchange 2013.  <\/p>\n<p>To list the members of a role:<\/p>\n<blockquote><p>[PS] >Get-RoleGroupMember &#8220;Organization Management&#8221;<br \/>\nCreating a new session for implicit remoting of &#8220;Get-RoleGroupMember&#8221; command&#8230;<\/p>\n<p>Name                                                        RecipientType<br \/>\n&#8212;-                                                        &#8212;&#8212;&#8212;&#8212;-<br \/>\nAdministrator                                               UserMailbox<\/p><\/blockquote>\n<p>To add somebody to a role:<\/p>\n<blockquote><p>[PS] >Get-RoleGroupMember &#8220;Organization Management&#8221;<\/p>\n<p>Name                                                        RecipientType<br \/>\n&#8212;-                                                        &#8212;&#8212;&#8212;&#8212;-<br \/>\nAdministrator                                               UserMailbox<br \/>\nJim Zimmerman                                               UserMailbox\n<\/p><\/blockquote>\n<p>Here is list of Exchange roles in Exchange 2010.  I believe most of these are in Exchange 2013 too:<br \/>\n<a href=\"https:\/\/technet.microsoft.com\/en-us\/library\/dd638077%28v=exchg.141%29.aspx\">https:\/\/technet.microsoft.com\/en-us\/library\/dd638077%28v=exchg.141%29.aspx<\/a><\/p>\n<p>Connector commands:<br \/>\nList Connectors:<\/p>\n<blockquote><p>[PS] C:\\>Get-ReceiveConnector<\/p>\n<p>Identity                                                    Bindings                                                    Enabled<br \/>\n&#8212;&#8212;&#8211;                                                    &#8212;&#8212;&#8211;                                                    &#8212;&#8212;-<br \/>\nMYEXSERVER\\Default MYEXSERVER                               {:::25, 0.0.0.0:25}                                         True<br \/>\nMYEXSERVER\\Client MYEXSERVER                                {:::587, 0.0.0.0:587}                                       True<br \/>\nMYEXSERVER\\Non-Exchange Relay Support                       {0.0.0.0:25}                                                True\n<\/p><\/blockquote>\n<blockquote><p>[PS] C:\\>Get-SendConnector<\/p>\n<p>Identity                                                    AddressSpaces                                               Enabled<br \/>\n&#8212;&#8212;&#8211;                                                    &#8212;&#8212;&#8212;&#8212;-                                               &#8212;&#8212;-<br \/>\nProduction SMTP Connector                                   {SMTP:*;1}                                                  True\n<\/p><\/blockquote>\n<p>To see all the settings for a single connector:<\/p>\n<blockquote><p>[PS] C:\\>Get-ReceiveConnector &#8220;MYEXSERVER\\Non-Exchange Relay Support&#8221; | Format-List<br \/>\n&#8230;<\/p><\/blockquote>\n<p>To change a setting for a connector:<\/p>\n<blockquote><p>[PS] C:\\>Get-ReceiveConnector &#8220;MYEXSERVER\\Non-Exchange Relay Support&#8221; -ProtocolLoggingLevel Verbose <\/p><\/blockquote>\n<p>A note on connector logging:<br \/>\nThe connector logs are stored on the Transport Hub server in the ExchangeInstallPath\\TransportRoles\/Logs\/ProtocolLog\/SmtpReceive for the receive connectors, and ExchangeInstallPath\\TransportRoles\/Logs\/ProtocolLog\/SmtpSend for the send connectors.<\/p>\n<p>Also, in a mixed version environment, the connector may have to be &#8220;upgraded&#8221; to support logging.  I was not able to turn on the the logging for my old Exchange 2003 connectors.  Upgrading basically consists of deleting and creating again.<\/p>\n<p>To view basic information about a mailbox:<\/p>\n<blockquote><p>[PS] C:\\>Get-Mailbox &#8220;<em>mailboxname<\/em>&#8221;\n<\/p><\/blockquote>\n<p>To view detailed information about a mailbox:<\/p>\n<blockquote><p>[PS] C:\\>Get-Mailbox &#8220;<em>mailboxname<\/em>&#8221; | Format-List<\/p><\/blockquote>\n<p>To filter that list:<\/p>\n<blockquote><p>[PS] C:\\>Get-Mailbox &#8220;<em>mailboxname<\/em>&#8221; | Format-List <em>properties<\/em><\/p><\/blockquote>\n<p>Or:<br \/>\n[PS] C:\\>Get-Mailbox &#8220;<em>mailboxname<\/em>&#8221; | Select <em>properties<\/em><\/p>\n<p>To see mailbox usage, number of items, etc:<\/p>\n<blockquote><p>[PS] C:\\>Get-MailboxStatistics &#8220;<em>mailboxname<\/em>&#8220;<\/p><\/blockquote>\n<p>Which you can filter as well:<\/p>\n<blockquote><p>[PS] C:\\>Get-MailboxStatistics &#8220;<em>mailboxname<\/em>&#8221; | Format-List <em>properties<\/em><\/p><\/blockquote>\n<blockquote><p>[PS] C:\\>Get-MailboxStatistics &#8220;<em>mailboxname<\/em>&#8221; | Select <em>properties<\/em><\/p><\/blockquote>\n<p>View mailboxes and sort them by size:<\/p>\n<blockquote><p>[PS] C:\\>Get-MailboxStatistics | Select DisplayName,TotalItemSize,LastLoggedOnUserAccount,LastLogonTime | Sort-Object -Property TotalItemSize<\/p><\/blockquote>\n<p>This works too:<\/p>\n<blockquote><p>[PS] C:\\>Get-MailboxStatistics -Server <em>servername<\/em> | Select DisplayName,ItemCount,TotalItemSize | Sort TotalItemSize<\/p><\/blockquote>\n<p>To view mailbox logon information:<\/p>\n<blockquote><p>[PS] C:\\>Get-LogonStatistics &#8216;mailboxname&#8217;<\/p><\/blockquote>\n<p>To view who has access to a mailbox:<\/p>\n<blockquote><p>[PS] C:\\>Get-MailboxPermission &#8220;<em>mailboxname<\/em>&#8220;<\/p><\/blockquote>\n<p>Add mailbox permission:<\/p>\n<blockquote><p>[PS] C:\\>Add-MailboxPermission -Identity &#8216;<em>mailboxidentity<\/em>&#8216; -User &#8216;<em>domain\\username<\/em>&#8216; -AccessRights &#8216;FullAccess&#8217;<\/p><\/blockquote>\n<p>Remove mailbox permission:<\/p>\n<blockquote><p>[PS] C:\\>Remove-MailboxPermission -Identity &#8216;<em>mailboxidentity<\/em>&#8216; -User &#8216;<em>domain\\username<\/em>&#8216; -AccessRights &#8216;FullAccess&#8217;<\/p><\/blockquote>\n<p>Move a mailbox:<\/p>\n<blockquote><p>[PS] C:\\>&#8217;cntouseraccount&#8217; | New-MoveRequest -TargetDatabase &#8216;<em>databasename<\/em>&#8216;<\/p><\/blockquote>\n<p>Example:<\/p>\n<blockquote><p>[PS] C:\\>&#8217;MY.DOMAIN\/MYOU\/my name&#8217; | New-MoveRequest -TargetDatabase &#8216;MYEXCHANGEDB&#8217;<\/p><\/blockquote>\n<p>To check move request statuses:<\/p>\n<blockquote><p>[PS] C:\\>Get-MoveRequest<\/p><\/blockquote>\n<p>For more detail, like how far a move has progressed:<\/p>\n<blockquote><p>[PS] C:\\>Get-MoveRequestStatistics -IncludeReport<\/p><\/blockquote>\n<p>To set the bad item limit for a mailbox that has partially been transferred:<\/p>\n<blockquote><p>[PS] C:\\>Set-MoveRequest -Identity \u00e2\u20ac\u0153<em>my name<\/em>\u00e2\u20ac\u009d -BadItemLimit <em>numberofitems<\/em><\/p><\/blockquote>\n<p>To resume a failed mailbox move:<\/p>\n<blockquote><p>[PS] C:\\>Resume-MoveRequest &#8216;my name&#8217;<\/p><\/blockquote>\n<p>To move a mailbox that has some corrupted items (in this case, one):<\/p>\n<blockquote><p>[PS] C:\\>&#8217;MY.DOMAIN\/MYOU\/my name&#8217; | New-MoveRequest -BadItemLimit 1 -TargetDatabase &#8216;MYEXCHANGEDB&#8217;<\/p><\/blockquote>\n<p>If you have a lot of issues:<\/p>\n<blockquote><p>[PS] C:\\>&#8217;MY.DOMAIN\/MYOU\/my name&#8217; | New-MoveRequest -BadItemLimit 100 -AcceptLargeDataLoss -TargetDatabase &#8216;MYEXCHANGEDB&#8217;<\/p><\/blockquote>\n<p>Note: these items will then not be migrated over the new location.<\/p>\n<p>To count the number of items in some output use Measure-Object:<\/p>\n<p>This more of a PowerShell tip than an EMS tip, but it is good to know when using EMS.<\/p>\n<blockquote><p>[PS] C:\\>Get-Mailbox | Measure-Object<\/p>\n<p>Count    : 124<br \/>\nAverage  :<br \/>\nSum      :<br \/>\nMaximum  :<br \/>\nMinimum  :<br \/>\nProperty :\n<\/p><\/blockquote>\n<p>To check the mail queues:<br \/>\nGet-Queue<\/p>\n<p>To retry or process messages in a queue:<\/p>\n<p>Queue notes:<\/p>\n<p>Check queues:<\/p>\n<blockquote><p>[PS] C:\\>Get-Message -Server <em>servername<\/em>\n<\/p><\/blockquote>\n<p>To check the queues:<\/p>\n<blockquote><p>Get-Queue<\/p><\/blockquote>\n<p>To force the messages in a queue to try again:<\/p>\n<blockquote><p>Retry-Queue -Filter {status -eq &#8220;retry&#8221;}<\/p><\/blockquote>\n<p>To try one queue again&#8221;<\/p>\n<blockquote><p>Retry-Queue -Identity Server\\Queue<\/p><\/blockquote>\n<p>Remove a message from a queue:<\/p>\n<blockquote><p>[PS] C:\\>Remove-Message -Identity <em>messageidentity<\/em><\/p><\/blockquote>\n<blockquote><p>[PS] C:\\>Write-Output <em>Output something.<\/em><\/p><\/blockquote>\n<p>To count the number message received on a day:<\/p>\n<blockquote><p>[PS] C:\\>Get-MessageTrackingLog -Start &#8220;<em>mm\/dd\/yyyy<\/em> 00:00&#8243; -End &#8220;<em>mm\/dd\/yyyy<\/em> 23:59&#8243; -EventID RECEIVE | Measure-Object<\/p><\/blockquote>\n<p>To find mailbox sizes and sort by size:<\/p>\n<blockquote><p>[PS] C:\\>Get-MailboxStatistics -Server <em>servername<\/em> | Select DisplayName,TotalItemSize | Sort TotalItemSize<\/p><\/blockquote>\n<p>To remove automapping.  Or how to grant access to a mailbox and not enable AutoMapping like the UI does:<\/p>\n<blockquote><p>[PS} C:\\>Add-MailboxPermission -Identity <em>mailboxname<\/em> -User <em>username<\/em> -AccessRight FullAccess -InheritanceType All -Automapping $false<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>This is more a reference for myself: I covered the basics of message tracking in: http:\/\/jim-zimmerman.com\/?p=1098 How to get the full Exchange version: Get-Command ExSetup | Format-List Get-Command ExSetup | ForEach {$_.FileVersionInfo} Here is a link to cross-reference the result to determine the service pack, etc.: https:\/\/technet.microsoft.com\/en-us\/library\/hh135098(v=exchg.150).aspx Create a mailbox (and account): New-Mailbox -Name &#8216;FirstName [&#038;hellip<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[358,125,293],"class_list":["post-1241","post","type-post","status-publish","format-standard","hentry","category-documentation","tag-ems","tag-exchange","tag-powershell"],"share_on_mastodon":{"url":"","error":""},"_links":{"self":[{"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/posts\/1241","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1241"}],"version-history":[{"count":41,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/posts\/1241\/revisions"}],"predecessor-version":[{"id":1590,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/posts\/1241\/revisions\/1590"}],"wp:attachment":[{"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1241"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1241"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1241"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}