document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. Get-MailboxStatistics | where {$_.Database -eq "Server1\\StorageGroup1\\MailboxDatabase1" -and $_.LastLogonTime -lt (get-date).addDays(-90) -and $_.ObjectClass -eq "Mailbox"} | sort-object lastlogontime | ft DisplayName >C:\\Exchange\\Cleanup\\NoLogin90Days.txt
  2.  
  3. $list1 = get-content C:\\Exchange\\Cleanup\\NoLogin90Days.txt
  4. $list1 | foreach {$_.TrimEnd()} > C:\\Exchange\\Cleanup\\NoLogin90Days.txt
  5. get-content "C:\\Exchange\\Cleanup\\NoLogin90Days.txt" | move-mailbox -targetdatabase "Server2\\StorageGroup2\\MailboxDatabase2"
  6. get-content "C:\\Exchange\\Cleanup\\NoLogin90Days.txt" | disable-mailbox
');