Exchange 2010 recovery

new-mailboxdatabase -recovery -name RDB1 -server servername -edbfilepath “c:\rectemp\support\support.edb” -logfolderpath “c:\rectemp\support”

get-mailboxdatabase

cd c:\rectemp\support
eseutil.exe /mh support.edb
esetuil.exe /p support.edb

restore-mailbox -identity administrator -recoverydatabase RDB1 -recoverymailbox “Boss” -targetfolder “recoverfolder1”

restore-mailbox -identity administrator -recoverydatabase RDB1 -subjectkeywords “Meeting” -contentkeywords “business” -includefolders \inbox

dismount-database RDB1 -confirm:$false
remove-mailboxdatabase RDB1

Increase office 365 Send & Receive attachment and message size

Get-MailboxPlan | fl name,maxsendsize,maxreceivesize,isdefault
Name : ExchangeOnline-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
MaxSendSize : 35 MB (36,700,160 bytes)
MaxReceiveSize : 36 MB (37,748,736 bytes)
IsDefault : False

Name : ExchangeOnlineDeskless-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
MaxSendSize : 35 MB (36,700,160 bytes)
MaxReceiveSize : 36 MB (37,748,736 bytes)
IsDefault : False

Name : ExchangeOnlineEnterprise-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
MaxSendSize : 35 MB (36,700,160 bytes)
MaxReceiveSize : 36 MB (37,748,736 bytes)
IsDefault : True

Get-Mailbox username | fl mailboxplan,maxsendsize,maxreceivesize
username ExchangeOnline-xxxxxxxx-xx… 35 MB (36,700,160 bytes) 36 MB (37,748,736 bytes)

Set-Mailbox username -MaxSendSize 50MB -MaxReceiveSize 51MB

Set-MailboxPlan ExchangeOnline-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -MaxSendSize 50MB -MaxReceiveSize 51MB
Set-MailboxPlan ExchangeOnlineDeskless-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -MaxSendSize 50MB -MaxReceiveSize 51MB
Set-MailboxPlan ExchangeOnlineEnterprise-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -MaxSendSize 50MB -MaxReceiveSize 51MB

Create Testing attachment file:
fsutil file createnew C:\45GBTest 47185920

Powershell to Office 365

$URL = “https://ps.outlook.com/powershell”
$Credentials = Get-Credential -Message “Enter your Office 365 admin credentials”
$EXOSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri $URL -Credential $Credentials -Authentication Basic -AllowRedirection -Name “Exchange Online”
Import-PSSession $EXOSession

If got the error, “cannot be loaded because the execution of scripts is disabled on this system”
Set-ExecutionPolicy RemoteSigned

Windows 2008 R2 + Exchange 2010

ServerManagerCmd -ip D:\Scripts\Exchange-Typical.xml -Restart
Set-Service NetTcpPortSharing -StartupType Automatic
http://go.microsoft.com/fwlink/?LinkID=191548

https://technet.microsoft.com/en-us/library/bb691354%28EXCHG.140%29.aspx
https://technet.microsoft.com/zh-cn/library/bb691354%28v=exchg.141%29.aspx

get-user -filter “department” -eq ‘sales'”
get-user -filter “department” -like ‘sales*'”
get-mailbox administrator | fl name,emailaddresses
get-casmailbox

Set on behalf of and send as permission:
set-mailbox boss -grantsendonbehalfto assistant
add-adpermission boss -extendedrights send-as -user assistant
restart-server msexchangeis

Show the user forwarding status:
get-mailbox Username | fl name,forwardingaddress,delivertomailboxandforward,recipientlimits

Show each user send receive limit:
get-mailbox | ft name,maxsendsize,maxreceivesize

Global message size limit:
get-transportconfig | fl max*size,maxrecipientenvelopelimit

Add retention deleted items:
new-retentionpolicytag “tag-deleteditems” -type “deleteditems” -comment “deleted items are purged in 60 days” -retentionenabled $true -agelimitforretention 60 -retentionaction permanentlydelete

Add retention default policy:
new-retentionpolicytag “tag-default” -type all -comment “items without a retention tag are deleted in 1 year.” -retentionenabled $true -agelimitforretention 365 -retentionaction movetodeleteditems -isprimary $true

Add retention business policy:
new-retentionpolicytag “tag-businesscritical” -type personal -comment “business critical messages are moved to the archive in 3 years.” -retentionenabled $true -agelimitforretention 1095 -retentionaction movetoarchive

Add retention group:
new-retentionpolicy “RP1” -retentionpolicytaglinks “tag-deleteditems”,”tag-businesscritical”,”tag-default”

Apply to user:
set-mailbox username -retentionpolicy RP1 -confirm:$false

restart-server msexchangeis
start-managedfolderassistant

Remove retention:
set-mailbox username -retentionpolicy $null
remove-retentionpolicy RP1
get-retentionpolicytag | remove-retentionpolicytag

Grant fullright access from user1 to user2:
add-mailboxpermission user1 -accessrights fullaccess -user user2

Display all edb path
get-mailboxdatabase | fl name,edbfilepath

Show state(Clean or Drily):
eseutil /mh

Repair with transaction log:
eseutil /r E05

eseutil /p

Integrity:
eseutil /g

Checksum:
eseutil /k

Fragment:
eseutil /ms

Defragment:
eseutil /d

Windows 7 connect to 365 via Powershell

Windows Management Framework 3.0
http://www.microsoft.com/en-us/download/details.aspx?id=34595
Windows6.1-KB2506143-x64.msu

Microsoft Online Services Sign-In Assistant for IT Professionals RTW
http://www.microsoft.com/en-us/download/details.aspx?id=41950
msoidcli_64.msi

Active Directory Module for Windows PowerShell (64-bit version)
http://go.microsoft.com/fwlink/p/?linkid=236297
AdministrationConfig-en.msi