Using a standard Icon for admin account

jeanr
New Contributor

Hey guys,

So in the midst of setting up our jamf i have a second user profile set up for our Dept to login to every laptop, Is there a way to set a standard profile pic using jamf pro ? Any advise would be great.

Thanks

10 REPLIES 10

AdamCraig
Contributor III

I pkg up a .png file and drop it into /Library/Application Support/CompanyName/ProfilePic.png
then run this script on the same policy after the install.

#! /bin/bash

## Written by strayer  6/12/19
## based on https://www.jamf.com/jamf-nation/discussions/3206/setting-default-user-picture-for-local-users

## Set the admin user icon

dscl . delete /Users/admin jpegphoto
dscl . delete /Users/admin Picture
dscl . create /Users/admin Picture "/Library/Application Support/CompanyName/ProfilePic.png"

exit 0

morsepacific
New Contributor III

I use an almost identical method for our users, but for some reason the image appears at the initial FileVault unlock screen when booting the machine, but the icon is just a grey person icon once logged into the OS.

ThierryD
New Contributor III

@morsepacific Hey, I noticed the same behavior ... @strayer any ideas ?

AdamCraig
Contributor III

I haven't seen that one. I've seen the icon disappear but that is because I accidentally overwrote the file on peoples computers with a different policy at one point. I've since rectified that and re-running the policy seemed to resolve that issue.

Philein
New Contributor III

@strayer when i use that script it returns this error:

<dscl_cmd> DS Error: -14009 (eDSUnknownNodeName)
delete: Invalid Path
<dscl_cmd> DS Error: -14009 (eDSUnknownNodeName)
delete: Invalid Path

Im on Big Sur. What could be wrong?

AdamCraig
Contributor III

@Philein Assuming you replaced "admin" with your username and updated the file path to the profile picture you want to use,
If the file path has a space in it make sure the path is in quotes.
I've run the script on Big Sur and it's worked for me so the commands are still valid.

leslie
Contributor II

This goes back a bit. Using dsimport to change the image

#!/bin/bash

username="someUser"
userPicture="/Users/Shared/yourImage.jpg"

## remove existing image references
dscl . delete /Users/"$username" Picture
dscl . delete /Users/"$username" JPEGPhoto

## import new image
if [ -f "$userPicture" ] ; then
    mappings='0x0A 0x5C 0x3A 0x2C'
    attributes='dsRecTypeStandard:Users 2 dsAttrTypeStandard:RecordName externalbinary:dsAttrTypeStandard:JPEGPhoto'
    pictureImport="/Library/Caches/$username.picture.dsimport"
    printf "%s %s 
%s:%s" "$mappings" "$attributes" "$username" "$userPicture" > "$pictureImport"
    # Check to see if the username is correct and import picture
    if id "$username" &>/dev/null ; then
        dsimport "$pictureImport" /Local/Default M && echo "Successfully imported profile picture."
    fi
else
    echo "picture not found"
fi

Philein
New Contributor III

Is there a way to set icons for everyone?

jlattke
New Contributor II

Also looking for a solution setting the icon for regular users to a "User Picture" and installed admins should use a special "Admin Picture" – so it's easy to see if all neccessary accounts on the machines … would be great if someone's having a idea how to solve … (we also are looking for a solution having special desktop backgrounds for the admins – so we can see on the first view who is logged in …)

leslie
Contributor II

Put this at the beginning of the script I'd posted earlier and remove the username= and userPicture= lines.

## get currently logged in user
username=$(stat -f%Su /dev/console)
## check admin status
isAdmin=$(/usr/sbin/dseditgroup -o checkmember -m "${username}" admin | cut -d" " -f1)
if [ "$isAdmin" = "yes" ];then
    userPicture="/Users/Shared/adminImage.jpg"
else
    userPicture="/Users/Shared/standardImage.jpg"
fi