Applescript is failing

written by fdooling

Hello, I have been tasked with disabling Outlook 2011 autodiscover for our department and when I create the custom fixlet it fails on all of the machines I have been testing it on. The Applescript is:

tell application “Microsoft Outlook”

set background autodiscover of exchange account 1 to false

end tell

I have tested this on my Mac using the Applescript editor and it works correctly.

Any help would be greatly appreciated.

written by jgstew

This seems like this would not work unless Outlook was already open on the target machine. Also, since BigFix / IEM actions happen as “root” and not as the current user, then it would probably be changing the setting for “root” and not the current user, if it is a per user setting.

Is this a per user setting or a machine level setting?

Is there a plist or MCX you can use to do this?

Update:

From here, this is a per user setting that requires outlook to be already open:
https://groups.google.com/forum/#!topic/macenterprise/fQtDZ0n3vYM

This applescript will not work through BigFix/IEM unless you can “run as current user” which would only change the setting for the currently logged on user. If you can manage this setting through MCX, then you should be able to deliver the MCX through BigFix/IEM.

written by fdooling

I have tested it on target machines with Outlook open and closed and it fails on both. We do not have the root user account enabled on any of our machines either. This will be a machine level setting.

written by jgstew

This is not a machine level setting, it is a per user setting. This will never work directly through BigFix/IEM. I’m not sure how ‘runascurrentuser’ works on the mac, but if there is such a thing, then you could run the applescript on the command line using ‘runascurrentuser’ if and only if there is a user logged on and they have outlook already open.

written by jgstew

From:
http://pastie.org/1798362

You need to run this, as the current user: /usr/bin/osascript -e ‘tell application “Microsoft Outlook” to set background autodiscover of exchange account 1 to false’

You would need the following relevance, in addition to checking that outlook is open: exists current user whose(name of it != “root”)

written by fdooling

I will give that a shot and let you know if it works, thank you so much

written by fdooling

The action failed, the action Script (type sh) is below:

#!/bin/sh /usr/bin/osascript -e ‘tell application “Microsoft Outlook” to set background autodiscover of exchange account 1 to false’

The relevance:

exists current user whose(name of it != “root”)

I verified Outlook was open on the target computer

written by jgstew

That would not work because it is still running as root, it need to “run as current user” which requires something else to be run first to make that happen. I am only used to doing so on the PC, not the Mac.

written by jgstew

See this:
https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014757482#77777777-0000-0000-0000-000014757482

written by fdooling

I tried that and it failed again. I will have to push this out with Apple Remote Desktop, something I was hoping to avoid.

written by jgstew

This is something that would be much better done through the use of MCX to manage the per-user setting. I have not done so, but I’m fairly confident you could manage MCX through BigFix/IEM.

The other option would be to impersonate the current user like this:

https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014757482#77777777-0000-0000-0000-000014757482

The client logs would be useful:

https://help.hcltechsw.com/bigfix/9.5/platform/Platform/Installation/c_logfiles.html

It is the case that BigFix/IEM is not well suited to manage user specific settings and requires some extra work to do so, but it is possible.