Resolving DirSync user permission errors (another cool script)

Let’s start with this image. DirSync is unable to perform the appropriate reads and write backs to these users.

2015-02-16_10-13-54

This is because the “Inheritance is blocked” on these users. This is normal for users that belong to Domain Admins. In the event that someone does something stupid and applies the wrong permissions to the domain or OU, it won’t apply to users that are members of Domain Admins. For example, what if we applied Deny all rights to the Everyone group at the domain level? It would basically break all access to active directory. So there is a built in service on domain controllers that un-checks this box on users that are members of the Domain Admins group… and keeps them from being completely locked out… but I’m getting off topic…

What we need to do to fix these DirSync issues is hunt down each of these users using active directory users and computers and perform a series of steps.

I labeled each of these steps with a number.

  1. Find the user, check the box to enable inheritance
  2. Click apply
  3. Un-check the box
  4. Choose Add, this will add the DirSync permissions onto the user
  5. Take a sip of coffee
  6. Click Apply
  7. Click Yes
  8. Click Ok

2015-02-16_10-19-56

2015-02-16_10-21-17

2015-02-17_21-55-25

2015-02-16_10-22-40

2015-02-16_10-23-53

Wow, that’s a lot of clicking.

Here is a script to make it easy.

Step 1) Right click on the error in DirSync and click Save to file…
It will be in XML format… call it whatever you want, like DirSyncErrors.xml

SNAG-0723

The XML file will look like this

SNAG-0727

Step 2) Run these two PowerShell commands from the directory where the xml file is located. This will extract the users distinguished names.

$xmlFile = [xml] (Get-Content ./DirSyncErrors.xml)
$xmlFile.SelectNodes('//export-error')|select -expand dn > UsersToFix.txt

The output will look like this text file. I called mine UsersToFix.txt

2015-02-16_10-56-32

Now download the Quest ActiveRoles Managment Shell tools from here: http://tinyurl.com/oukq26q

Step 3) Create a script, I called it FixInheritance.ps1 that has the following code. Start the Quest ActiveRoles Shell and run this script in the shell.

$File = Get-Content './UsersToFix.txt'
Foreach ($user in $File) {
Set-QADObjectSecurity $user -UnlockInheritance
Set-QADObjectSecurity $user -LockInheritance
}

This will perform the same 8 steps shown above and it’s a whole let less clicking, and keep those scripts in your toolbox folder for future Office 365 deployments.

Advertisements

Easily add Hybrid email address to users that don’t follow e-mail address policy

When attempting to move a mailbox to Office 365 one of most common failures is due to the user not containing the hybrid email address. This is because this check box is unchecked and this is done because the user has a custom email address that does not follow the conventions of the email policy.

In other words, because the check box with the green arrow is unchecked, the email address with the red arrow is not created. The email address with the red arrow is the hybrid address. It’s form is mail alias@<tenant name>.mail.onmicrosoft.com An example would be bjones@xyz.mail.onmicrosoft.com

2015-02-17_13-28-01

This first powershell one liner will find all the mailbox users with this box unchecked and dump the results into a csv file.

Get-Mailbox -ResultSize Unlimited | Where {$_.EmailAddressPolicyEnabled -eq $False} |select Alias,PrimarySmtpAddress |export-csv -NoTypeInformation MailboxesPolicyUnchecked.csv

The second one I called “AddTenantHybridSMTP.ps1” and the contents of that script is below. Without this script you woudl have to hunt down each of these users and check the box, select apply, then un-check the box and then designating the non standard email as the default email address, then click apply again.(Whew, that’s a lot of clicking !)

This script just adds the hybrid address to the user.
You will want to change the tenant name to the appropriate value; I have it as XYZ.

$CSV = Import-CSV ./MailboxesPolicyUnchecked.csv
foreach ($entry in $CSV) {
$TenantEmail = $entry.alias + "@XYZ.mail.onmicrosoft.com"
set-mailbox $entry.PrimarySMTPAddress -EmailAddresses @{Add=$TenantEmail}
}

Enjoy!

UPDATE

I had an issue that some users didn’t have the hybrid address even though the “apply policy” was indeed checked.

Not sure why that happened and I don’t care (LOL)

The script below will find the users that do not have a hybrid email address; you would need to modify the red “bvhs” part to the customer’s tenant name

Get-Mailbox -ResultSize Unlimited -Filter "emailaddresses -notlike '*@xyz.mail.onmicrosoft.com'" |select alias,primarysmtpaddress |export-csv -NoTypeInformation UsersWithOUTHybrid.csv

In some ways, it’s better than my first script, which is…

Get-Mailbox -ResultSize Unlimited | Where {$_.EmailAddressPolicyEnabled -eq $False} |select Alias,PrimarySmtpAddress |export-csv -NoTypeInformation MailboxesPolicyUnchecked.csv

Because that only lists the users where the email policy is not applied…. But for some strange reason… there are users without the hybrid address but the policy is indeed checked.

OneDrive sharing replaces traditional attachments in OWA

Using the Office 365 Outlook Web App, you can attach files directly from your OneDrive as Links.

2015-02-05_20-20-46

Adding a file automatically takes you to your OneDrive folder.

2015-02-05_20-27-34

But what if the file is still on your computer and NOT on your OneDrive… No problem, just click “Computer”

 2015-02-05_20-35-34

After you select the file, it gives you the option to upload it to your OneDrive and Share a link.

2015-02-05_20-36-04

It looks like an attachment from here….2015-02-05_20-41-35

You can also decide if the recipients can modify the document in real time or view only

2015-02-05_20-52-46

When the recipient gets the message, it’s a link to OneDrive. In this example, I mailed it to my live.com (hotmail) account.

2015-02-05_20-44-47

But what if you sent it a non-Microsoft system, such as Gmail? The user will actually get two messages, and the second one looks like this.

2015-02-05_21-06-34

Clicking on the “sign in” word in blue takes you to this page where the user needs to create a Microsoft Account, or logon as one they have.

2015-02-05_21-09-09

Now you can send those really big PowerPoint files as links rather than attachments. Typically, companies set limits on how big your messages can be. I typically see message size limits set anywhere between 10 megabyte and 35 megabyte. OneDrive is built into Office 365 and is a subset of SharePoint Online. Oh, and it’s awesome !!

Office 365 Advantages (not found in your typical ads)

I am going to outline some advantages available to current Exchange users that migrate to Office 365.

  • If you have Exchange on premise, it is fairly easy to setup a hybrid environment. This means you can have some users with mailboxes on premise and some mailboxes in Office 365 and your end uses experience seamless communication.
  • Users in the cloud see the same address book as users on premise.
  • Users logon to Office 365 using their email address as their logon name and the SAME password as they do on premise.
  • Hybrid configuration allows mail flow between on premise and cloud users to be seen as internal (SCL = -1) if you understand that.
  • Hybrid allows free/busy lookups between on premise and Office 365 to work when creating a meeting.
  • When mailboxes are moved to the cloud, the Outlook client re-configures itself using the autodiscover service and the same profile is used. This means the Outlook OST file does not need to be rebuilt.
  • Mailbox moves can be ramped up to 99% and held there. When you, the admin clicks “finish migration”, the mailbox move is completed within 10 mins or less and the Outlook client is prompted to restart. This allows you control over when the mailbox is migrated. Very important for those “high touch” end users.
  • Phones experience the same automatic reconfiguration as the Outlook client.

Other advantages in going to Office 365 with the E3 or E4 licenses.

  • 50 GB mailboxes with Unlimited Archive mailboxes.
  • An extremely fast installation of Office 2013 (Word, Excel, Powerpoint, etc) that is branded Office 365. We call this a click to run install.
  • Up to 5 installations per user of this version of Office. The license is tied to the user’s Office 365 credentials, so the end user can install Office at home, and when they are no longer with the company, their license expires. No more handing out CDs with the product key written on it with a sharpie (Hoping their kids won’t get a hold of it.)
  • OneDrive with UNLIMITED storage; OneDrive is built into Windows 8.1 and Windows 10
  • Continuous updates to Office 365 online portal (you may know this as OWA) allowing you to take advantage of the latest features without any effort from you, the administrator.
  • High Availability that would cost way more if you tried to implement on premise.
  • The administrator will never have to worry about backups again.
  • End to end encryption is available without having to install an additional appliance such as ZixGateway or Entrust appliance.
  • Ability to keep all mail with “in place hold” feature for a desired duration (such as 7 years), including deleted mail which does NOT affect the 50 GB mailbox quota.
  • The ability to link URLs (Web addresses) that point to large files stored in your OneDrive rather than using traditional attachments. Can’t attach that 100 megabyte powerpoint or visio document? No problem with OneDrive linking.

I haven’t touched on ALL the advantages, but hopefully this will give you some technical insight to the advantages of migrating to Office 365. In future posts, I will go deeper into these advantages.

Office-365-664x374

Office 365 Move Report

I have been doing a lot of Office 365 lately and I’ve been getting very “tired” of checking the status of mailbox moves at night. I get on the pc, check the status of the moves, then go back to the family. Yea, right…. I check the moves, go to youtube, and 40 mins later my wife asks “Have I lost you again to the box?”

I have to first connect to the cloud with the three magical commands in powershell.

 $O365Cred = Get-Credential
 $O365Session = New-PSSession –ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell -Credential $O365Cred -Authentication Basic -AllowRedirection
 Import-PSSession $O365Session

The script emails me a progress report of mailbox moves every 10 mins. It needs to “relay out”, so I make sure I’m either pointing to the exchange server (or another server) that allows me to do this.

The “how many times it emails me” can be changed by modifying the do-while loop parameter. Currently the loop is set to 5 times. {while ($i -le 6)}
The “how often it emails me” can be changed by modifying the Start-Sleep parameter, which is set to 600 seconds {Start-Sleep -s 600}
Change the smtp server from   $smtpServer = “relay.domain.com”   to the server that will relay for you. Change the From and To addresses to your liking, and you are all set.

I was able to check my live.com email account and see updates from my phone.

Here is the script:

$i = 1
 do {
#Get Statistics on move requests, sort by percent complete
$Moves= Get-MoveRequest | Get-MoveRequestStatistics | select-object Alias, TotalInProgressDuration,PercentComplete| sort-object PercentComplete
$Moves  |ConvertTo-Html |out-file Moves.htm
#So i know what's happening, I have it write to the screen that it's sending mail
Write-Host "Sending Email"
     #SMTP server name
      $smtpServer = "relay.domain.com"
     #Creating a Mail object
      $msg = new-object Net.Mail.MailMessage
     #Creating SMTP server object
      $smtp = new-object Net.Mail.SmtpClient($smtpServer)
     #Email structure 
      $msg.From = "no-reply@domain.com"
      $msg.ReplyTo = "no-reply@domain.com"
      $msg.To.Add("youremail@yourdomain.com")
      $msg.subject = "MoveReport"
      $msg.IsBodyHTML = $true
      $msg.body = get-content .\moves.htm
     #Sending email 
      $smtp.Send($msg)

#Pause for 600 seconds (10 mins) 
Start-Sleep -s 600
 $i++
 }
 while ($i -le 6)

DirSync generates 10,000 email alerts

While DirSync is a nice canned version of FIM, I have found it can run in a wild loop. By Default the DirSync tool runs every 3 hours. If there are any errors, it generates an email to the technical contact’s email within the tenant configuration.

I was able to make it generate about 2 or 3 email conflict reports per second. That equates to 10,000+ emails in an hour.What caused this? Having an active directory forest with multiple domains. To understand let’s say there are two bob jones. One with a default UPN of bjones@chicago.domain.com and bjones@madison.domain.com, and let’s say for clarity these are also represented by the names chicago\bjones and madison\bjones, as in domain\samaccountname. Technically there is no conflict. The UPNs are unique across the forest and the samaccountnames are unique within each respective domain.

Using a powershell command I can set the UPN suffix to @domain.com for both accounts. It should be noted that the ADUC utility will prevent conflicts from occurring, thus allow changing the first one to @domain.com, but then prevent the second one from being changed to @domain.com

After there became two bjones@domain.com UPNs, DirSync found itself in a loop. When it generates a sync report to the technical contact on the office 365 tenant, it did so at a rate of 2 to 3 per second. This would not stop until I made one account different, such as bjones2@domain.com

I changed it to make every account the same as their email. What I didn’t expect what that bob jones in chicago, his logon account might have been chicago\bjones, but his configured email was bob.jones@domain.com. The administrator ran into a conflict while creating the email account in the Exchange management console (EMC) and unchecked “Use Policy” and gave bob in chicago a non standard email address.

Lessons learned: Set the UPN prefix to the prefix the the default email address, and then set the suffix to @domain.com.

Besides, I have run into places where you may logon as bj9874 and your email is bob.jones@domain.com. I would think you really want everyone logging in using their email address on office 365 portal, rather then their userid.

It’s worth noting that the prefix of the upn is, by default, is the same as the samaccount name when you setup the account in ADUC or EMC.

 

SkyDrive Pro client for Windows now available

Today, Microsoft announced the release of SkyDrive Pro client for windows.

This is great for K1 (kiosk) licensed users of Office 365. While they might not have Office 2013, can still access their files on the local machine.

It can also be installed side-by-side with previous versions of Office (Office 2010, Office 2007).

Read the official blog from Microsoft here.