Outlook SSL

Tim_Apple
New Contributor II

Hey there,

we're trying to set some advanced settings in Microsoft Outlook. We want to tick the red outlined box and enable SSL.

Screen Shot 2022-01-14 at 13.38.38.png

Right now we're using this script, which work's, but throws an error. I'm not really into scripting but i tried a little bit on my own and came out with the following:

osascript <<END
tell application "Microsoft Outlook"
    set ldap server of exchange account 1 to "XXX"
    set ldap use ssl of exchange account 1 to yes
    set ldap port of exchange account 1 to 6666
end tell
END 

It throws no error, but it won't enable SSL either. I think it's because I don't define the default exchange account and I don't really know how to do it. Shouldn't it be just "exchange account 1"? I tried many things out but I can't get it to work...

Thanks for any help!

8 REPLIES 8

junjishimazaki
Contributor III

Hi, please remember in Jamf it runs any policy as root not as a user so to get a script to run as a user do this:

# Get current logged in user

curUser="`stat -f%Su /dev/console`"

#Run script as user

sudo -u $curUser osascript <<'END'
tell application "Microsoft Outlook"
    set exList to get every exchange account
    repeat with exItem in exList
        set exDomain to get server of exItem
        if exDomain is "https://OurServer.org/EWS/Exchange.asmx" then
            set ldap server of exItem to "ldap.OurServer.org"
            set ldap port of exItem to 3269
            set ldap use ssl of exItem to true
        end if
    end repeat
end tell
END

 

Yes, you're right, but somehow this is working without running it as user. It enables SSL but still throws the following error:

Script result: 252:306: execution error: Microsoft Outlook got an error: The user name of the account is required. (-1715)

junjishimazaki
Contributor III

I just tested this script and it worked for me. How are you testing this?

I run it like this:

 

#!/bin/bash

# Get current logged in user
curUser="`stat -f%Su /dev/console`"

# Run script as user
sudo -u $curUser osascript <<'END'
tell application "Microsoft Outlook"
    set exList to get every exchange account
    repeat with exItem in exList
        set exDomain to get server of exItem
        if exDomain is "Server" then
            set ldap server of exItem to "Server"
            set ldap port of exItem to 3269
            set ldap use ssl of exItem to true
        end if
    end repeat
end tell
END

 

 

junjishimazaki
Contributor III

Sorry, let me clarify. I meant how are you testing this script? Are you running locally to test or in Jamf?

Ah, I use a policy, available in self service, which calls the script

junjishimazaki
Contributor III

Is an Outlook profile already existing when you tested this?

Yes, there is an active profile when testing.