KACE run script as user on macOS

I see the possibility to run a script as

local system

logged in user

or specify credentials

but only on Windows. I need to run a script in the user context on macOS. How can I achieve this?

0 Comments   [ + ] Show comments

Answers (2)

Posted by: horacior 2 years ago
Second Degree Brown Belt

Try this. The line goes at the top of the macOS scripts, and It has been working fine with my scripts.

One thing to consider is, if you have several "sudos" or commands that you need to be executed within the script, you might need to repeat that line right before these commands run.

# Pull current logged in user into 'user' variable.

user=`ls -l /dev/console | cut -d " " -f 4`

I hope it helps.

Posted by: KevinG 2 years ago
Red Belt

Not an option on Mac or Linux devices.

This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ