User Profile Picture

SirDewalt
New Contributor III

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?

1 ACCEPTED SOLUTION

Hugonaut
Valued Contributor II

@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.

 

"

________________
Looking for a Jamf Managed Service Provider? Look no further than Rocketman
________________


Virtual MacAdmins Monthly Meetup - First Friday, Every Month

View solution in original post

3 REPLIES 3

mmcallister
Contributor II

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

Hugonaut
Valued Contributor II

@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.

 

"

________________
Looking for a Jamf Managed Service Provider? Look no further than Rocketman
________________


Virtual MacAdmins Monthly Meetup - First Friday, Every Month

SirDewalt
New Contributor III

Thanks this is exactly what I needed.