Yosemite: Outlook for Mac Exchange Setup Script

sven_eberhard
New Contributor

Does anyone use the Outlook for Mac Exchange Setup Script from talking moose with Yosemite?
Version 4.5.2 - https://github.com/talkingmoose/Outlook-Exchange-Setup

The dscl query dos not work, so it appear the Error: DSOpenDirServiceErr

This is the script line in the Script-Editor:
set emailAddress to do shell script "dscl "/Active Directory/" & domainName & "/All Domains/" -read /Users/" & shortName & " EMailAddress | cut -d ':' -f2 | sed s'/ //g'"

1 ACCEPTED SOLUTION

m_entholzner
Contributor III

I think I found the error in the script - there's an error when the system version is checked in the script. If system_version > 10.10 the script will fail.

I simply removed support for 10.5 and 10.6 and the system_version variable so that all dscl's are done with the one for >10.7.

View solution in original post

12 REPLIES 12

talkingmoose
Moderator
Moderator

I'm no longer in an environment to test Active Directory, but dscl should still work from what I understand. Easiest way to troubleshoot is to use dscl interactively in the Terminal.

On your test Mac that's bound to AD, launch Terminal and type "dscl" followed by return. You should see a "> " prompt.

Use "ls" to list items and then "cd" to change directory. For example, you'll type "ls" first and you should see one of the results as "Active Directory". Use "cd Active Directory" to change directory to "Active Directory".

Use "ls" again and you should see your NETBIOS domain name. Enter "cd YOURNETBIOSNAME" followed by return and you change directory into your domain.

Keep using "ls" and "cd" to browse your Active Directory hierarchy until you see the Users folder. If you get that far then dscl is working just fine. We'll need to troubleshoot from there.

Look
Valued Contributor III

I used a fair amount of code out of that script, but I have modified it significantly for our environment.
I guess what I am trying to say is that even if the script doesn't work directly, the basic concept still does and it's probably just a matter of debugging it somewhat.

sven_eberhard
New Contributor

We are using the Script with our 10.9 Clients without any Problems in the same environment.
The Active Directory Domain and the Path to Users is absolute the same.

It is possible to browse with dscl manually.
I have spend a lot of time to find out what can be wrong with decl script line, but without success.

talkingmoose
Moderator
Moderator

The instructions I provided above are for browsing Active Directory using dscl.

For more insight about using dscl to access directory services, I'll point you to my presentation slides from MacIT this year where I spoke on this topic. I try to write my slides to be somewhat step-by-step but slides are rarely a substitute for the presentation itself. Hope these will be enough to get the concepts across.

Browsing Open Directory starts around slide 40. Browsing Active Directory starts around slide 87.

Access Directory Services from the Command Line
http://talkingmoose.net/2014/03/posting-my-macit-2014-presentations/

talkingmoose
Moderator
Moderator

Clicked "Post It" too soon.

After you've established you can browse Active Directory using dscl, you'll need to break down the command in the script to its parts and test each part.

Start with this, replacing your NETBIOS domain name (TALKINGMOOSE) and a valid user name (moose) in the command. Remember, this only works on a Mac bound to Active Directory and while you're logged in as an Active Directory user.

dscl "/Active Directory/TALKINGMOOSE/All Domains/" -read /Users/mmoose"

This should return a lot of information for the user. If that works, try to get the email address next. EMailAddress is case sensitive, by the way.

dscl "/Active Directory/TALKINGMOOSE/All Domains/" -read /Users/mmoose" EMailAddress

If that works then the rest of the script is just trimming out the extra data to get the email address by itself. Test this...

dscl "/Active Directory/TALKINGMOOSE/All Domains/" -read /Users/mmoose" EMailAddress | cut -d ':' -f2

Then test the full command...

dscl "/Active Directory/TALKINGMOOSE/All Domains/" -read /Users/mmoose" EMailAddress | cut -d ':' -f2 | sed s'/ //g'

Are you able to spot where the command breaks?

m_entholzner
Contributor III

I think I found the error in the script - there's an error when the system version is checked in the script. If system_version > 10.10 the script will fail.

I simply removed support for 10.5 and 10.6 and the system_version variable so that all dscl's are done with the one for >10.7.

talkingmoose
Moderator
Moderator

Good catch, @entholzner!

It was poor form of me to treat OS X version numbers as real numbers but I recall thinking this was acceptable at the time since it worked. Now that "10.10" (real number "10.1") is out, this will have to change.

rmaldon
New Contributor III

Hey all, came across this thread and it seemed to be the closest to what I was looking for...

@talkingmoose - This script is great, and has been humming along perfectly for initial outlook setup on 10.9 machines, but for some reason if the Mac is on 10.10. I get an error with the first time setup:

external image link

In our environment, our structure would follow the "--first.last@domain.com and full name displays as "First Last"" and on 10.9 machines it actually figures that out through the logic in the script... but for some reason on 10.10 it gets stuck here.... I tried commenting this section out, but it still continues to get stuck with that "text item 2" message.

I followed your troubleshooting steps for dscl up top, and everything was fine. It all returned properly so Im just puzzled now as to why it won't identify "text item 2". Any thoughts on this? Ive been trying a bunch of different things, but Im out of ideas now...

Thanks again for this!

RogerH
Contributor II

Just stopped working

@talkingmoose][/url][/url the script no longer compiles under 10.10.2 it keeps throwing syntax errors. I was working on the script under 10.10.1 and it worked fine not sure whats changed

RogerH
Contributor II

the error is

Expected variable name, class name or property but found application constant or consideration

tell application "Microsoft Outlook"
            activate
            set newExchangeAccount to make new exchangeaccount with properties ¬
                {name:"Mailbox - " & fullName, user name:shortName, full name:fullName, email address:emailAddress, server:ExchangeServer, use ssl:ExchangeServerRequiresSSL, port:ExchangeServerSSLPort, ldap server:DirectoryServer, ldap needs authentication:DirectoryServerRequiresAuthentication, ldap use ssl:DirectoryServerRequiresSSL, ldap max entries:DirectoryServerMaximumResults, ldap search base:DirectoryServerSearchBase, ldap port:DirectoryServerSSLPort}

talkingmoose
Moderator
Moderator

@RogerUL

Just verifying you don't have Outlook 15 installed alongside Outlook 2011 on your machine. AppleScript will more than likely look at Outlook 15.

Let me know when you can. I'm working on the next version of the script now and hope to post something next weekend or so.

Thank you!

bwiessner
Contributor II

@ talkingmoose

I sent you a message at the mspmacadmins.org site - is there a better way to reach you?