Disconnected mailboxes and disconnected date

To display mailboxes that are disconnected use the following command.
Replace with the name of your mailbox server.
This gives a list of the disconnected mailboxes.
Get-MailboxStatistics -Server | where { $_.DisconnectDate -ne $null } | select DisplayName,DisconnectDate

To reconnect you use the command below
Connect-mailbox –database "mailbox database name" –Identity "disconnected mailbox name" –User "User to connect to"

Find the last time a database was accessed

select d.name, x1 =
(select X1= max(bb.xx)
from (
select xx = max(last_user_seek)
where max(last_user_seek) is not null
union all
select xx = max(last_user_scan)
where max(last_user_scan) is not null
union all
select xx = max(last_user_lookup)
where max(last_user_lookup) is not null
union all
select xx = max(last_user_update)
where max(last_user_update) is not null) bb)
FROM master.dbo.sysdatabases d
left outer join
sys.dm_db_index_usage_stats s
on d.dbid= s.database_id
group by d.name

Run Cleanup agent in Exchange 2007

After the deletion of a user with an mailbox this mailbox is left on the mailserver as an “disconnected mailbox”.

The process can take some time but can be started manual.

Start the “Exchange Management Shell”

Clean-MailboxDatabase “Your_Mailbox_Database_Name”

Change UPN in Office 365

Set-MsolUserPrincipalName -UserPrincipalName [CurrentUPN] -NewUserPrincipalName [NewUPN]

Enable or Disable Circular Logging in Exchange 2010

Open Exchange Management Console
  1. In Organization Configuration click on Mailbox
  2. Tab Database Management
  3. Right click on the database
  4. Tab Maintenance
  5. Check “Enable circular logging”
PowerShell

Set-MailboxDatabase -CircularloggingEnabled:$true

Remember to re-disable it when done.

Set-MailboxDatabase -CircularloggingEnabled:$false