Posted on 12-11-2023 01:52 PM
Hello, I am new to jamf and our client is requesting that we automate turning off of Natural Scrolling. I have found a script that when run in terminal works perfect and does not prompt the user for anything. Currently this is what I am using:
#!bin\bash
defaults write NSGlobalDomain com.apple.swipescrolldirection -bool false
When I go to run this through jamf it just fails and does nothing. I'm sure I am missing something but have racked my brain and cannot figure it out. Thanks in advance for the help.
Solved! Go to Solution.
Posted on 12-11-2023 04:20 PM
Testing this out myself, it seems you may have to run it as the user rather than running it as root (as Jamf scripts natively do). So you can try something like this:
#!/bin/bash
loggedInUser=$(stat -f%Su /dev/console)
loggedInUID=$(id -u $loggedInUser)
/bin/launchctl asuser $loggedInUID sudo -iu $loggedInUser defaults write NSGlobalDomain com.apple.swipescrolldirection -bool false
Posted on 12-11-2023 04:20 PM
Testing this out myself, it seems you may have to run it as the user rather than running it as root (as Jamf scripts natively do). So you can try something like this:
#!/bin/bash
loggedInUser=$(stat -f%Su /dev/console)
loggedInUID=$(id -u $loggedInUser)
/bin/launchctl asuser $loggedInUID sudo -iu $loggedInUser defaults write NSGlobalDomain com.apple.swipescrolldirection -bool false
Posted on 12-11-2023 04:25 PM
Can not really say anything without knowing why script fails. but you can run as a command.
policy > Files and Processes then put
defaults write NSGlobalDomain com.apple.swipescrolldirection -bool false