Exchange management shell commands. These were tested on Exchange 2010 and may vary for newer versions. Also make sure that the server selected for the Global Catalog (GC) is actually a GC. The DC and GC settings can also be modified via regedit, but of course be very careful when using regedit.
List Exchange settings
get-exchangeserver -identity EXCHANGESERVER | fl
Set static DC or GC
set-exchangeserver -identity EXCHANGESERVER -staticdomaincontrollers DC1.COMPANY.COM set-exchangeserver -identity EXCHANGESERVER -staticglobalcatalogs DC1.COMPANY.COM
Check and attach mailboxes
clean-mailboxdatabase -identity "MAILBOX DATABASE NAME"