Posted on 03-23-2022 09:28 AM
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?
Solved! Go to Solution.
03-23-2022 12:44 PM - edited 03-23-2022 12:46 PM
#!/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.
"
Posted on 03-23-2022 10:47 AM
You could try this script, it will step through all existing users - https://scriptingosx.com/2018/10/changing-a-users-login-picture/
03-23-2022 12:44 PM - edited 03-23-2022 12:46 PM
#!/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.
"
Posted on 06-24-2024 07:03 AM
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.
Posted on 03-24-2022 09:30 AM
Thanks this is exactly what I needed.