Skip to main content
Solved

User Profile Picture

  • March 23, 2022
  • 5 replies
  • 57 views

Forum|alt.badge.img+3

I'm trying to find a way to force a User Profile picture for all users via Jamf Pro. I have spent a day now reading posts about it and they all seem to assume that I already know what the User profile name is and that it is going to be the same on all computer or the scripts are not working/ erroring out or they say to set it up to be done before the user profile is created. none of these solutions work for my needs. I need to be able to force change the picture on all existing profiles with out already knowing what the profile name is.

All the computers are running Monterey or newer.

Is there anyway to do this?

Best answer by Hugonaut

@SirDewalt 

 

#!/bin/bash : HEADER = <<'EOL' ██████╗ ██████╗ ██████╗██╗ ██╗███████╗████████╗███╗ ███╗ █████╗ ███╗ ██╗ ██╔══██╗██╔═══██╗██╔════╝██║ ██╔╝██╔════╝╚══██╔══╝████╗ ████║██╔══██╗████╗ ██║ ██████╔╝██║ ██║██║ █████╔╝ █████╗ ██║ ██╔████╔██║███████║██╔██╗ ██║ ██╔══██╗██║ ██║██║ ██╔═██╗ ██╔══╝ ██║ ██║╚██╔╝██║██╔══██║██║╚██╗██║ ██║ ██║╚██████╔╝╚██████╗██║ ██╗███████╗ ██║ ██║ ╚═╝ ██║██║ ██║██║ ╚████║ ╚═╝ ╚═╝ ╚═════╝ ╚═════╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═══╝ Name: Hugonaut Description: Modify End User Login Image EOL CURRENT_USER=$([[ $3 ]] && echo "$3" || defaults read /Library/Preferences/com.apple.loginwindow lastUserName) dscl . delete /Users/$CURRENT_USER jpegphoto dscl . delete /Users/$CURRENT_USER Picture dscl . create /Users/$CURRENT_USER Picture "/Library/Application Support/DIRECTORY-NAME-HERE/LOGIN-IMAGE-HERE.png"

 

 

 

just replace "DIRECTORY-NAME-HERE" & "LOGIN-IMAGE-HERE.png" with the location / image you are deploying to the end users computer.

 

"

5 replies

Forum|alt.badge.img+9
  • Valued Contributor
  • March 23, 2022

You could try this script, it will step through all existing users - https://scriptingosx.com/2018/10/changing-a-users-login-picture/


Hugonaut
Forum|alt.badge.img+15
  • Esteemed Contributor
  • Answer
  • March 23, 2022

@SirDewalt 

 

#!/bin/bash : HEADER = <<'EOL' ██████╗ ██████╗ ██████╗██╗ ██╗███████╗████████╗███╗ ███╗ █████╗ ███╗ ██╗ ██╔══██╗██╔═══██╗██╔════╝██║ ██╔╝██╔════╝╚══██╔══╝████╗ ████║██╔══██╗████╗ ██║ ██████╔╝██║ ██║██║ █████╔╝ █████╗ ██║ ██╔████╔██║███████║██╔██╗ ██║ ██╔══██╗██║ ██║██║ ██╔═██╗ ██╔══╝ ██║ ██║╚██╔╝██║██╔══██║██║╚██╗██║ ██║ ██║╚██████╔╝╚██████╗██║ ██╗███████╗ ██║ ██║ ╚═╝ ██║██║ ██║██║ ╚████║ ╚═╝ ╚═╝ ╚═════╝ ╚═════╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═══╝ Name: Hugonaut Description: Modify End User Login Image EOL CURRENT_USER=$([[ $3 ]] && echo "$3" || defaults read /Library/Preferences/com.apple.loginwindow lastUserName) dscl . delete /Users/$CURRENT_USER jpegphoto dscl . delete /Users/$CURRENT_USER Picture dscl . create /Users/$CURRENT_USER Picture "/Library/Application Support/DIRECTORY-NAME-HERE/LOGIN-IMAGE-HERE.png"

 

 

 

just replace "DIRECTORY-NAME-HERE" & "LOGIN-IMAGE-HERE.png" with the location / image you are deploying to the end users computer.

 

"


Forum|alt.badge.img+3
  • Author
  • New Contributor
  • March 24, 2022

Thanks this is exactly what I needed.


emanueldiaz_09
Forum|alt.badge.img+4

@SirDewalt 

 

#!/bin/bash : HEADER = <<'EOL' ██████╗ ██████╗ ██████╗██╗ ██╗███████╗████████╗███╗ ███╗ █████╗ ███╗ ██╗ ██╔══██╗██╔═══██╗██╔════╝██║ ██╔╝██╔════╝╚══██╔══╝████╗ ████║██╔══██╗████╗ ██║ ██████╔╝██║ ██║██║ █████╔╝ █████╗ ██║ ██╔████╔██║███████║██╔██╗ ██║ ██╔══██╗██║ ██║██║ ██╔═██╗ ██╔══╝ ██║ ██║╚██╔╝██║██╔══██║██║╚██╗██║ ██║ ██║╚██████╔╝╚██████╗██║ ██╗███████╗ ██║ ██║ ╚═╝ ██║██║ ██║██║ ╚████║ ╚═╝ ╚═╝ ╚═════╝ ╚═════╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═══╝ Name: Hugonaut Description: Modify End User Login Image EOL CURRENT_USER=$([[ $3 ]] && echo "$3" || defaults read /Library/Preferences/com.apple.loginwindow lastUserName) dscl . delete /Users/$CURRENT_USER jpegphoto dscl . delete /Users/$CURRENT_USER Picture dscl . create /Users/$CURRENT_USER Picture "/Library/Application Support/DIRECTORY-NAME-HERE/LOGIN-IMAGE-HERE.png"

 

 

 

just replace "DIRECTORY-NAME-HERE" & "LOGIN-IMAGE-HERE.png" with the location / image you are deploying to the end users computer.

 

"


You can also create a variable and assigned it to Parameter 4: NEW_PICTURE="$4"

Then add your new variable to where you would type in the path in the script "${NEW_PICTURE}"

This will allow you to reuse the script without having to retype out a new path everytime.


get2brad-sdm
Forum|alt.badge.img+2
  • New Contributor
  • April 2, 2025

Thanks this is exactly what I needed.


Just reporting in, this is still working in Sequoia 15.4. 🙌Thanks!