How to connect to Office 365 Exchange with powershell

 Fire up powershell

 

$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection

Import-PSSession $Session

To disconnect the session:

Remove-PSSession $Session

shared mailbox Office 365 – cannot expand folder both in OWA and Outlook

There is a bud in the GUI of Office 365 when delegating full permission to a user for shared mailbox.

Even if you give the correct permission you cannot expand the mailbox.

The fix is to remove and readd the permission with these powershell comamnds:

To Add

Add-MailboxPermission -Identity JDoe -User ‘testuser22’ -AccessRights FullAccess -InheritanceType All -AutoMapping $false

To Remove

Remove-MailboxPermission -Identity JDoe -User ‘testuser22’ -AccessRights FullAccess -InheritanceType All

How to remove system mailboxes and arbitration / federated mailboxes from last Exchange 2010 / 2013

This is just a plain copy paste for a note for myself.

please visit http://msexchangeguru.com/2013/01/02/exchange-2013-error/ which is the source for this paste

To resolve this, we need to move or disable the arbitration mailboxes on the server and remove the mailbox database manually.

You need to also ensure you do not have any user mailboxes in the database you are trying to get rid of.

Start Exchange Management Shell and type the command to display mailboxes in the whole forest and not just the domain you are logged into:

[PS] C:Windowssystem32>$AdminSessionADSettings.ViewEntireForest=$True

[PS] C:Windowssystem32>Get-MailboxDatabase -Server nbc-d-mbx02

Name Server Recovery ReplicationType

—- —— ——– —————

Database15         NBC-D-MBX02 False None

[PS] C:Windowssystem32>Get-MailboxDatabase “nbc-d-mbx02Database15” | Get-Mailbox

Now that you have the list of all mailboxes in the exchange database, move it to a different server

To work around the Arbitration mailbox issue, let’s find out the list of all Arbitration mailboxes

[PS] C:Windowssystem32>Get-Mailbox -Arbitration |ft Name, Servername

Name ServerName

—- ———-

SystemMailbox{1f05a927-0695-4348-bb62-d2369dcb23d5} nbc-d-mbx01

FederatedEmail.4c1f4d8b-8179-4148-93bf-00a95fa1e042 nbc-d-mbx01

SystemMailbox{e0dc1c29-89c3-4034-b678-e6c29d823ed9} nbc-d-mbx02

SystemMailbox{bb558c35-97f1-4cb9-8ff7-d53741dc928c} nbc-d-mbx02

Migration.8f3e7716-2011-43e4-96b1-aba62d229136 nbc-d-mbx02

Now will disable all of those since I do not have a different server to move them to.

[PS] C:Windowssystem32>Disable-Mailbox “SystemMailbox{e0dc1c29-89c3-4034-b678-e6c29d823ed9}” -Arbitration -DisableLastArbitrationMailboxAllowed

Confirm

Are you sure you want to perform this action?

Disabling mailbox “SystemMailbox{e0dc1c29-89c3-4034-b678-e6c29d823ed9}” will remove the Exchange properties from the Active Directory user object and mark the mailbox in the database for removal. If the mailbox has an archive or remote archive, the archive will also be marked for removal. In the case of remote archives, this action is permanent. You can’t reconnect this user to the remote archive again.

[Y] Yes [A] Yes to All [N] No [L] No to All [?] Help (default is “Y”): a

[PS] C:Windowssystem32>Disable-Mailbox “SystemMailbox{bb558c35-97f1-4cb9-8ff7-d53741dc928c}” -Arbitration -DisableLastArbitrationMailboxAllowed

Confirm

Are you sure you want to perform this action?

Disabling mailbox “SystemMailbox{bb558c35-97f1-4cb9-8ff7-d53741dc928c}” will remove the Exchange properties from the Active Directory user object and mark the mailbox in the database for removal. If the mailbox has an archive or remote archive, the archive will also be marked for removal. In the case of remote archives, this action is permanent. You can’t reconnect this user to the remote archive again.

[Y] Yes [A] Yes to All [N] No [L] No to All [?] Help (default is “Y”): a

[PS] C:Windowssystem32>Disable-Mailbox “Migration.8f3e7716-2011-43e4-96b1-aba62d229136” -Arbitration -DisableLastArbitrationMailboxAllowed

Confirm

Are you sure you want to perform this action?

Disabling mailbox “Migration.8f3e7716-2011-43e4-96b1-aba62d229136” will remove the Exchange properties from the Active Directory user object and mark the mailbox in the database for removal. If the mailbox has an archive or remote archive, the archive will also be marked for removal. In the case of remote archives, this action is permanent. You can’t reconnect this user to the remote archive again.

[Y] Yes [A] Yes to All [N] No [L] No to All [?] Help (default is “Y”): a

[PS] C:Windowssystem32>Get-MailboxDatabase -Server nbc-d-mbx02

Name Server Recovery ReplicationType

—- —— ——– —————

Mailbox Database 0912423282 NBC-D-MBX02 False None

[PS] C:Windowssystem32>Remove-MailboxDatabase “Mailbox Database 0912423282”

Confirm

Are you sure you want to perform this action?

Removing mailbox database “Mailbox Database 0912423282”.

[Y] Yes [A] Yes to All [N] No [L] No to All [?] Help (default is “Y”): a

WARNING: The specified database has been removed. You must remove the database file located in E:Program FilesMicrosoftExchange ServerV15MailboxMailbox Database 0912423282Mailbox Database 0912423282.edb from your computer manually if it exists. Specified database: Mailbox Database 0912423282

Remove autodiscover from Exchange 2010 after migrating to Office 365

This is just a 100% copy from this excellent blog as a note for myrself. : http://kirb.it/enable-office-365-auto-discover-for-outlook-in-sbs-2011-exchange-environments/

 

Enable Office 365 Auto-discover for Outlook in SBS 2011 Exchange Environments

One of the  issues you will run into when migrating from an on premises Exchange 2010 server on SBS 2011 is that Outlook will not autodiscover the correct Office 365 server settings. Fortunately this can be easily solved with a few simple PowerShell commands.

  1. Open an Exchange Management Shell as an administrator. (Elevated PowerShell)
  2. Use the following command to discover the Identity name of your Autodiscover Virtual Directory. Either note or copy the values in the Identity field.
    Get-AutodiscoverVirtualDirectory | fl Name, Server, InternalUrl, Identity
    Retrieve Exchange Autodiscover Virtual Directory Settings - SBS 2011
  3. Use the following command to remove the AutoDiscover Virtual Directory. Be sure to replace the text inside the quotes with the value in the Identity field above.
    Remove-AutodiscoverVirtualDirectory –Identity “Insert identity value here”
     Virtual Directory for Exchange 2010
  4. You will have to confirm the removal by hitting Y for yes when prompted. You can double check to see if this worked properly by rerunning the command in step 2.  You should get a blank result if successful.

That should be it. Your Outlook clients should connect successfully to the Office 365 service.

 

Delete all the items in a maibox in Exchange 2013

I imported an .pst into the wrong mailbox (but before I gave the credential to the user..) and with 25.000 emails this was not something I would want to do in Outllok with hang etc…

So how can I do this directly on the Exchange 2013 server? Easy! With a one-line in powershell!

But you have to give your administrator the Mailbox Search role and Mailbox Import Export in the ECP. Look at this wonderful blog on how you do that first: http://blogs.technet.com/b/samdrey/archive/2011/02/17/exchange-2010-rbac-issue-mailbox-import-export-gt-new-mailboximportrequest-and-other-management-role-entries-are-missing-not-available.aspx

So how do I delete the content with a one liner?

Search-Mailbox -Identity «name of mailbox» -DeleteContent -Force

What we do is basically doing a search in the mailbox without filtering and delete the results. With this approach you can lso filter certain elements and just delte them.

F.ex if you just want to delete all calendar entries in a mailbox:

Search-Mailbox -Identity «name of mailbox» –SearchQuery kind:meetings –DeleteContent

You can also show the estiates on what would be deleted without actually deleting anything by adding –EstimateResultOnly at the the end:

Search-Mailbox -Identity «name of mailbox» –SearchQuery kind:meetings –DeleteContent –EstimateResultOnly

Fore more specific filter, look at this blog which is also the source for my blog:

http://theucguy.net/delete-all-calendar-entries-in-an-exchange-2010-mailbox/

 

 

 

Owa search stopped working in Exchange 2013

A customer running Exchange 2013 Cu2 was facing an issue with their OWA. search did not working and just gave an error. The application and system event log was reporting issue with the hostcontroller.exe. The service «Microsoft Exchange Host Search Controller» was not running and would just terminale unexpectedl when I tried to start it. Deleting the index database didnt help either, still no search results.

the solution was to run the following (see the screenshot). I then deleted the content index database (which remains in a sub-catalogue where you have your mailbox databases) and restartet both «Microsoft Exchange Search» and «Microsoft Exchange Host Search Controller». After a few minutes a few .tmp files was created and deleted fast in the same dir as the mailboxdatabases resides, starting with cts*.tmp.  After that the search was working and the search service also run fine.

Skjermbilde 2014-05-27 kl. 23.00.30

 

 

 

How to give administrator full access to all exchange mailboxes

There are times when you want, or have to, give the administrator full access to all the exchange mailboxes. This is f.ex the case when you want to restore an email in Veeam directly into the mailbox for the user. The default Exchange permission will just give the users access to their mailboxes.

You can give individual access to users by delegating the access in the Exchange ECP (2013), but to apply this to all mailboxes you can use the following powershell command

Get-MailboxDatabase -identity «[mailbox database name]» | Add-ADPermission -user [username] -AccessRights GenericAll

source: http://msandbu.wordpress.com/2013/06/02/surebackup-and-exchange-u-air-with-veeam/

 

Blogg på WordPress.com.

opp ↑