-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPost-Install.sh
More file actions
21 lines (18 loc) · 876 Bytes
/
Copy pathPost-Install.sh
File metadata and controls
21 lines (18 loc) · 876 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/bash
# -----------------------------------------------------------------------------
# Script Name: admin-elevation.sh
# Description: Adds the current logged-in user to the macOS admin group.
# Intended for use as a post-install script in a dummy .pkg
# deployed via Workspace ONE UEM to temporarily grant admin rights.
#
# Author: Brian Irish
# Platform: macOS
# Requirements: Must run in the context of a macOS device with DEP/MDM enrollment
# Usage: Workspace ONE > Internal App > Post-Install Script
# -----------------------------------------------------------------------------
loggedInUser=`/usr/bin/stat -f%Su /dev/console`
if [ "$loggedInUser" == "root" ] || [ "$loggedInUser" == "_mbsetupuser" ]; then
exit 0
fi
# Adds user to admin group (post-install)
dseditgroup -o edit -a "$loggedInUser" -t user admin