Entering Exchange Product Key in Exchange Powershell

Task: Enter in the Exchange Product Key in Exchange Powershell by using the command below.

Set-ExchangeServer servername ProductKey aaaaa-aaaaa-aaaaa-aaaaa-aaaaa
Even though you can see the new edition on Exchange, the new edition/product key will not be fully activated until the Information Store service is restarted. The new editions functionality will not be there until the service restart. Restart it from Exchange Powershell Below.

Creating Exchange Databases and creating Database Copies in Exchange Powershell

Task: To create Exchange DB’s and DB Copies, follow the following powershell commands below. Note everything with this highlight will need your adjusting.

Create the DB:
New-MailboxDatabase dbname -Server servername -LogFolderPath C:dbfolderLogs -EDBFilePath C:dbfolderDBdbname.edb 
Mount the DB:
Mount-Database dbname 
Add the DB Copies to other DAG members:
Add-MailboxDatabaseCopy dbname -MailboxServer PassiveServerName -ActivationPreference 2 
Add-MailboxDatabaseCopy dbname -MailboxServer PassiveServerName -ActivationPreference 3 
Add-MailboxDatabaseCopy dbname -MailboxServer PassiveServerName -ActivationPreference 4 

Mailbox is Disabled after Reconnecting mailbox from disconnected state.

Scenario: After you reconnect a disconnected mailbox, you may receive the following error in Outlook Web App, ​ ‘Your mailbox has been disabled.’ You may also have trouble connecting to her mailbox in powershell or EMC saying the mailbox is not avaiable.
SolutionRun the following command in Exchange Powershell.
clean-mailboxdatabase <Database Name>

modify domain names for hybrid org relationship

​Task: Modify domain names configured for an organization relatinship in a hybrid deployment
you can use powershell command below to complete task
$domains = (get-organizationrelationship ‘On Premises to Exchange Online Organization Relations
hip’).domainnames
 
Set-organizationrelationshp -id  ‘On Premises to Exchange Online Organization Relations

hip’ -domainnames $domains

Exchange PowerShell to Recover Mailbox Items in Exchange 2010.

Scenario: A user is missing mailbox items because they were accidentally deleted or moved from the mailbox and the user cannot find these missing items in their “Recover Deleted Items” folder accessible in Outlook. (Note: How to access the Recover Deleted Items section in Outlook: Outlook 2010 & Outlook 2007)

Next Step: In Exchange 2010 PowerShell, a administrator can use the New-MailboxExportRequest command to create a PST of the users mailbox. The command will export the contents of the mailbox into a PST, in addition reveal the RecoverableItems folder which is a hidden folder in the mailbox that is not seen by Outlook. This folder may contain the contents of the missing items.
Ex2010 Powershell Commands:
Creating the PST Requests:
New-MailboxExportRequest username -filepath ServernameShareFile.pst
This will copy everything from the mailbox and put it in a .PST file that you can open in Outlook.
Monitoring the PST Requests:
Get-MailboxExportRequest
-Shows the status of the move requests
Get-MailboxExportRequest | Get-MailboxExportRequestStatistics
-Shows the percentage of completion
You can also attach the |FL shell command to existing command it will show all of the available information attached to the move requests.
After the PST request completes:
Once the PST is finished building, you can open it up in Outlook and try to find the missing mailbox items in the recoverable items folders. If you cannot find the missing items, its possible a restore will need to be performed from backup in order to find the missing data.

Offboarding and Onboarding Mailboxes

Offboarding and Onboarding mailboxes to/from Office365
Moving mailboxes 2-way can be done using the EAC from Office365. You may also connect Powershell to Office365 and run any of the scripts below:
Onboarding to Cloud:
$opcred = get-credential [domainadmin]
Get-Mailbox xx| New-MoveRequest -Remote -RemoteHostName ‘mail.domain.com’ -RemoteCredential $opcred -TargetDeliveryDomain ‘o365.mail.onmicrosoft.com’
Offboarding from the Cloud to OnPrem:
$opcred = get-credential [domainadmin]
Get-Mailbox xx| New-MoveRequest -OutBound -RemoteTargetDatabase ‘Mailbox Database xxxxxxxx’ -RemoteHostName ‘mail.domain.com’ -RemoteCredential $opcred -TargetDeliveryDomain ‘domain name’

Remove role entry from a role–RBAC

​Remove role entry from a role–RBAC
For eg, to remove set-casmailbox role entry from mail recipient role, you can follow these steps:
scenario: user wants to remove set-casmailbox role entry  from mail recipient role associated to a rolegroup called airwatch which has org client access, recipient policies and mail recipient roles
1. step 1
New-ManagementRole -name “Airwatch-Mail-Recipient-No-CASMailbox” -Parent “Mail Recipients”
2. Step 2
Get-ManagementRoleEntry “Airwatch-Mail-Recipient-No-Casmailbox*” | ?{$_.name -like “set-casmai
lbox”} | remove-managementroleentry -confirm:$false
3. Step 3
Add the new management role to existing role group. you can use the console to do this

Outlook web app is out of date

Issue: you try to login with office 365 homed mailbox, from the on-prem login url and you get the error ” your OWA is out of date”
Resolution: Check the remote mailbox properties and ensure target address is set with the correct address. You can also use powershell to fix by typing
set-remotemailbox -id test -remoteroutingaddress test@o365test.onmicrosoft.com
the alias must be an onmicrosoft.com alias​