DirSync and Office 365

I wanted to share this for my own reference, but wanted to share the love.

Have been having a challenge with people thinking I am talking cr@p, which make me smile.  If I am wrong I will admit it.

When you setup DirSync, users from your onPrem AD are copied to the Office 365 Azure AD. Simple.

When you migrate (onboard) a mailbox to Office 365 the onPrem accounts change:

RecipientType RecipientTypeDetails RecipientType RecipientTypeDetails
UserMailbox UserMailbox -> MailUser RemoteUserMailbox
UserMailbox SharedMailbox -> MailUser RemoteSharedMailbox
UserMailbox RoomMailbox -> MailUser RemoteRoomMailbox

Now if you have a filter based on msExchRecipientTypeDetails you need to watch out, as expected the msExchRecipientTypeDetails changes:

Type Before After
User Mailbox 1 2147483648
Shared Mailbox 4 8589934592
Room Mailbox 16 17173869184
Equipment Mailbox 32 34359738368

This caused me some challenges as we had a filter that would only migrate disabled accounts with a value of 4 or 16 in msExchRecipientTypeDetails.

The net result was that after a Shared or Room mailbox was onboarded to o365 they would drop out of DirSync.  This is okay, as they stay in the Azure AD as a deleted user for 30 days.

You can recover a user from deleted users, they appear in Azure AD as “In Cloud” and any mailbox they had is accessible.

This is the fun bit. If the recovered user is added back in to dirsync, dirsync uses the Azure AD ImmutableId and compares that to an OnPrem Guid.  If a match they are become Dirsynced again.

You can see the ImmutableId when your run a get-msoluser.  Essentially it’s a fudge of the OnPrem AD ObjectGuid.  This post explains and here is a script to convert between the two.

Hope this helps someone, it helped me, get an understanding of what the hell was going on!

If this is complete cr@p let me know please!

Exchange 2010 with UAG and Moving Mailboxes to o365

Came across this the other, when moving mailboxes from Exchange 2010 to Office 365.

The move works, but takes a hell of a long time.  If you look in the move logs you see:

Transient error MrsHttpInternalServerErrorException has occurred.

It would appear that UAG has a limit of some kind that is causing these errors.

I have not tried this, however Microsoft suggest you can try create following registry key on the UAG servers.

 Value: 30 (Decimal)

Microsoft suggests that this registry key should be removed from the servers, after completing the mailbox migration task.

Activate the UAG server configuration after applying this registry key and then do “IISreset” on all UAG servers.

Outlook says .. Microsoft Exchange is not available

This was is a good one and has been doing my head in!

I had a user mailbox that could log in to OWA but not Outlook.

With outlook you would get an error saying:

"Cannot open your default e-mail folders. Microsoft Exchange is not available. Ether there are network problems or the exchange Computer is down for maintenance"

If you run:

Get-LogonStatistics -Identity <email address>

Then have a look at the FullMailboxDirectoryName

This should match the users legacyexchangedn.  In my case, another user has the same address as a proxy address.

Just removed it and everything worked fine!


#Exchange2010 #MsExchange #Powershell

Hello every Happy New Year and all that .. long time to talk.

Wanted to share this.  Basically had a Cisco UCS Blade failure today, where it took 2 nodes of a 3 node Exchange 2010 dag out.

Its been a fun day! NOT!

Anyway, I knocked this script up to monitor the database copy status when we put everything back.

PARAM([String]$Server = (HOSTNAME),
[int]$time            = 30)

Write-Host "Server:.."$Server
Write-Host "Timer:..."$time
$position = $host.ui.rawui.cursorposition
$position.y = $position.y+4
  Get-MailboxDatabaseCopyStatus -Server $Server
  $endpos = $host.ui.rawui.cursorposition
  for($i=1;$i-le $time;$i++){write-host "." -nonewline -f Yellow;sleep 1}
  Write-Host (" "*$time)

Find Exchange Databases using Powershell

A small change in $strFilter=”(objectClass=msExchPrivateMDB)” and you get all the mailbox databases ;-)

$forest    = [System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest()
$Dom  = "LDAP://CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=" + $Forest.Name.Replace(".",",DC=")
$Root       = New-Object DirectoryServices.DirectoryEntry $Dom 
$selector   = New-Object DirectoryServices.DirectorySearcher 
$selector.PageSize    = 1000 
$selector.Filter      = $strFilter 
$selector.SearchRoot  = $root 
$selector.SearchScope = "Subtree" 
$Objs = $selector.findall() 

Find Exchange Servers using Powershell

#Powershell #MsExchange

I have a suite of discovery scripts that I use every now and then.  I adapted this to look in the AD and get a list of the exchange servers!

$forest    = [System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest()
$Dom = "LDAP://CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=" + $Forest.Name.Replace(".",",DC=")
$Root       = New-Object DirectoryServices.DirectoryEntry $Dom
$selector   = New-Object DirectoryServices.DirectorySearcher
$selector.PageSize   = 1000
$selector.Filter     = $strFilter
$selector.SearchRoot = $root
$selector.SearchScope = "Subtree"
$Objs = $selector.findall()

Backing up Exchange Server 2010 with Windows Server Backup and Powershell

#powershell #msexchange

This was fun, or not as the case may be.So I have a temporary Exchange 2010 server that I am using to migrate users on to, and then off at a later date.

I slapped a 2TB external usb disk in the back of the server and wanted to back it up.  Using the GUI is easy, but I wanted to use Powershell do it!

Now you can use wbadmin to run a backup, but this for some reason doesn’t work if you run it in powershell.  After some digging I found the powershell snapin windows.serverbackup

So you can start powershell and run Add-PsSnapin windows.serverbackup

You then find a whole load of cmdlets you can use.  Check it them here: http://technet.microsoft.com/en-us/library/ee706683.aspx<

I’m not going to go in to real detail, but this is basics:

$policy = New-WBPolicy
$fileSpec = New-WBFileSpec -FileSpec D:\exchange.databases\database.swing01 
Add-WBFileSpec -Policy $policy -FileSpec $filespec
$fileSpec = New-WBFileSpec -FileSpec D:\exchange.databases\database.swing02 
Add-WBFileSpec -Policy $policy -FileSpec $filespec
$fileSpec = New-WBFileSpec -FileSpec D:\exchange.databases\database.swing03 
Add-WBFileSpec -Policy $policy -FileSpec $filespec

Set-WBVssBackupOptions -Policy $policy -VssFullBackup   
$backupLocation = New-WBBackupTarget -NetworkPath $BackupTarget 
Add-WBBackupTarget -Policy $policy -Target $backupLocation   
Start-WBBackup -Policy $policy

Microsoft Surface Pro 3

#SurfacePro3 #Surface


Well, well, well, I can confirm that the Surface Pro 3 does actually exist.  In the UK mine rocked up on Thursday 28th August 2014 as anticipated. WP_20140828_14_56_05_Pro
When you open the box you have the tablet WP_20140828_15_46_16_Pro
Under it the is the pen, the user guide and the power supply.You have to put the battery in the pen, and the power supply does have a USB port on it too, which is good. WP_20140828_15_46_46_Pro

Now the surface pro as been to the phat farm! The original Surface RT comes in at 689g, while the Surface Pro tips the scales at 913g (My Lenovo Helix is 851g). The Surface Pro 3 is only 804g! and a lot bigger.

As a comparison, this is the Surface Pro vs Surface Rt WP_20140828_15_45_03_Pro

While the Surface Pro vs Surface Pro 3.  So for people in the UK, the Surface Pro 3 is about the size of a sheet a A4 paper. WP_20140828_15_51_21_Pro

To top it off you can see how much thinner the Surface Pro 3 is to a Surface Pro (on the right) WP_20140828_15_55_02_Pro
Now for the keyboards!  Shame Microsoft doesn’t bundle them in with the surface.  The surface Pro 3 is larger than the Surface Pro, so the keyboard are bigger WP_20140828_15_43_37_Pro
What is kinda cool is that the keyboard lights up up ;-) WP_20140829_22_44_14_Pro
Right, let get down to it then. So I have the core i7 version and it quite nippy as you would expect. It has 512GB SSD and 8GB of RAM. sp3_cpuz1


The screen is very nice sp3_display


I have only been using my Surface Pro 3 since Thursday, and have not had the chance to really using it in anger.  However, I have performed a really basic battery test.From fully charged (The manual says it takes 2-4 hours to fully charge your Surface Pro 3 battery from an empty state),  I have watched 4x50min episodes of a TV series from an external hard disk.After the first one the battery went from 100% to 85% and the last 3 used ~ 20% of battery each leaving me with 10% and a low battery warning.For me this ok!  I don’t have anything else to compare it against but I can live with that.  So on Monday, I used my Surface Pro 3 “normally” on WiFi, VPN’ed to work, using an RDP session, PowerPoint, word and a bit of windows powershell. End result was around 6 hours use.  I feel that is acceptable.Oh by the way, the video play back was awesome and the audio was good too!
This is taken from the surface pro 3 user guide http://www.microsoft.com/surface/en-us/support/userguides with some comments.Touchscreen: The 12” touchscreen, with its 3:2 aspect ratio and 2160 x 1440 resolution display. Multi-touch lets you use your fingers to select, zoom, and move things around.Surface Pen: Enjoy a natural writing experience, with a pen that feels like an actual pen. [It actually does feel really nice and has a good weight to it too!]

Kickstand: Flip out the Surface Pro 3 kickstand to any angle and work or play comfortably at your desk, .on the couch, or while giving a hands-free presentation. Choose the angle that’s right for you. [This is really strange.  If flips out to one angle, but then you need to move it to adjust it more.  At first it feels like your going to break it!]

Wi-Fi and Bluetooth: Surface supports standard Wi-Fi protocols (802.11a/b/g/n/ac) and Bluetooth® 4.0 Low Energy technology.

Two cameras and two microphones: Two 5-megapixel cameras for recording videos and taking pictures. Both cameras record video in 1080p, with a 16:9 aspect ratio (widescreen).

Stereo speakers and headset jack: Stereo speakers with Dolby® enhanced sound and headset jack.

Full-size USB 3.0 port: Connect USB accessories—like a mouse, printer, or an Ethernet adapter.

microSD card reader: Use the microSD card reader [This is what my Lenovo Helix is missing!].

Mini DisplayPort 1.2: Share what’s on your Surface Pro 3 by connecting it to an HDTV, monitor, or projector.

Charging port and 36-watt power supply: Connect the included 36-watt power supply when your battery is low [Has a USB port in it too!].

Processor: 4th generation Intel® Core™ i3, i5, i7

Storage and Memory: Choose from 64GB or 128GB storage with 4GB RAM, or 256GB or 512GB storage with 8GB RAM.

TPM: TPM chip [Now this is interesting, by default the C drive is bitlocker encrypted!].

Sensors: Surface has four sensors (an ambient light sensor, an accelerometer, gyroscope, and magnetometer).


So, what do I think? Well I have used a lot of tablets over the years.  It started with a Toshiba M400 and my last one was a Lenovo Helix.  The Microsoft Surface Pro 3 is by far the best I have used. Size, weight and usability are excellent, the only thing that lets it down is the price, and with I mean the extra cost for the keyboard. If it wanted anything else, I would say another usb3 and maybe 3g, but that is all.

But so far I love it!

#Powershell Export-Clixml and Import-Clixml

I had a need to store some user data.  Using the Exchange 2010 Management Shell I could use Get-User and Get-Mailbox to get what I needed, but when you export it to CSV, some of the fields don’t export very well at all.I was looking at all kinds of funky ways to export the data, but then stumbled upon Export-Clixml.

I was amazed.  I could run say Get-Mailbox bob | Export-Cixml bob.xml

Then I could run $x = Import-Clixml bob.xml anywhere and I would have a variable ($x) with bob’s mailbox information in!

How cool is that!