Intermittent Policy application

i_am_error
New Contributor

I have a baffling problem with a Profile I recently set up to turn on the mouse right-click function for the Macs in an estate I'm managing for a customer.

I created a Policy to run the following command:

defaults write /Users/$USER/Library/Preferences/com.apple.driver.AppleHIDMouse.plist Button2 -int 2

Which switches on right-click for the given user.

Trigger: Login
Execution frequency: Once per user per computer
Scope: All Managed clients

But when I check the clients on which the script has run, the right-click is not turned on. However, when I was testing the Policy, I initially scoped it to one Mac, and it worked fine, but since extending the scope to all computers, it has stopped working altogether. Only manually running the command from Terminal on a given client invokes the right-click as expected.

The Policy results give a status of 'Completed', yet the Policy itself hasn't done anything since the script hasn't taken effect. It's even more confusing to me because it worked when I was testing it.

Can anybody think of anything I might've missed and/or any reason why the script won't run? I'd be grateful for any feedback on this.

2 REPLIES 2

bentoms
Release Candidate Programs Tester

@i_am_error Scripts ran by the JSS run as root.

So the $USER will be getting the root accounts username.

I have a blog post here, which details some different ways to get the logged in users username.

Alternatively, set the script to run @ Login or Self Service & use $3 instead of $USER

i_am_error
New Contributor

Aha! I knew I must've missed something. :)

Seems so obvious thinking about it now!

I'll peruse your blog and give that a go. Thank you very much. :)