Posted on 05-11-2023 12:20 PM
I am looking for a way of scripting the account icon for a local user account used across multiple devices. Instead of a random picture, the idea is that this account would be singularly identifiable on any device.
Using dscl seems to be the method and maybe it is just identifying the image path for default Apple icons or Monogram.
There are scripts like this one that utilize a resource folder being placed so a custom image can be utilized, but in this case a generic user silhouette or Monogram is what I am looking for.
In the past I found that attempting to set the user icon via script, if the path to the image didn't exist or was invalid, the icon would revert to a default grey silhouette picture. This worked for what I am trying to achieve but I would like to specifically set it using a known method, to a Memoji or already existing icon, even the headshot silhouette picture.
Posted on 05-11-2023 12:28 PM
I use this
#!/bin/sh
#Get logged in user
loggedInUser=`/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'`
# Delete any Photo currently used.
dscl . delete /Users/$loggedInUser jpegphoto
sleep 1
# Delete File path
dscl . delete /Users/$loggedInUser Picture
sleep 1
# Set New Icon
dscl . create /Users/$loggedInUser Picture "/pick/a.file.tif"
then set the script to run
Once per user per computer