13

I have created new user and set a password for him.

Can I also set account picture for him?

I searched following places:

  1. New windows style: PC Settings -> Accounts

  2. Medium age windows style: Control Panel -> User Accounts -> Manage another account

  3. Old age Windows NT style: Administrative tools -> Computer management -> Local Users and Groups.

May be I am late and the progress went ahead? May be they already created fourth semi-functional applet for user management?

UPDATE

Note that the question is about how to set picture of a DIFFERENT user. So, the method including logging in as new user can not be regarded as an answer, because once I logged as some user, I am not different of him anymore.

Also normal security setup doesn't allow anyone to log in as any one else, even an administrator.

Dims
  • 12,244
  • 78
  • 161
  • 252
  • 2
    The "usertile" value which stores the user account picture is stored in the SAM hive. This [script](https://tmintner.wordpress.com/2010/06/23/usertile-automation-part-1/) does it in earlier versions, but doesn't work in Windows 10 when I tested. But gives you an idea how and where to change the setting. Editing the SAM is risky. – w32sh Apr 04 '16 at 10:41
  • Your update make no sense. The question did not state that not logging as a different user is a requirement. Adding restrictions after a question has been answered is not something we like to see here. – DavidPostill Oct 27 '18 at 15:52
  • 2
    @DavidPostill once I log as different user, I will change "my" icon, not of different user. "Different user" means "different user account than one currently logged in". – Dims Oct 27 '18 at 20:19
  • @Dims My answer explains how to change the icon of the currently logged in user. If you log in as him you will change his icon not your icon. Which is what the original question asked before you added the log in as someone else restriction. – DavidPostill Oct 27 '18 at 20:28
  • @DavidPostill what do you mean by "his" or "my" icon? User accounts are not people and icons belong to user accounts, not for humans. One user can have multiple accounts, or user account may be not intended for logons at all. I am sure you know all this. – Dims Oct 27 '18 at 20:31
  • @Dims Of course I know this. I'm referring to to specific user accounts. Are you trying to change the scope of your question again? I suggest let it go as I have already explained "I deliberately left this answer in place as it answer's the OP's original question before he edited it and it may help future visitors to the site. There was no requirement about logging in mentioned in the original question" – DavidPostill Oct 27 '18 at 20:36
  • 1
    @DavidPostill look at the first version of a quesion: https://i.imgur.com/gNcCWL3.png Word "different" was there and was capsed. You just ignored it. I don't understand the sense of this dispute. I can't accept answers for different questions, sorry – Dims Oct 27 '18 at 20:39
  • @Dims I'm not asking you to accept the answer. Lets agree to differ. – DavidPostill Oct 27 '18 at 20:42
  • 1
    @DavidPostill, there is no sensible argument here. He asked for a different user right in the subject line in the first rendition of his question. It's why I came here in the first place. Your answer is for something else entirely. – tgm1024--Monica was mistreated Oct 28 '18 at 00:50
  • 1
    [How to change user’s picture in Windows 10 of others users being administrator](https://superuser.com/q/1113302/150988) asks the same question, but it doesn’t have an answer either.   [How to add picture to User Account on Windows 10?](https://superuser.com/q/963115/150988) has an answer that is similar to David’s, but without the illustrations. – Scott - Слава Україні Nov 03 '18 at 20:10
  • 1
    I wish that instead of bickering someone posted a _real_ solution to the question. I had no other choice than logging in as a different user to change their picture. It seems a bit strange not to be able to change the other user's picture, considering that I'm the Admin... – Gwyneth Llewelyn Sep 09 '19 at 13:48
  • What do you mean "normal security setup doesn't allow anyone to login as any one else"? Are we talking about Group Policies and Windows Server here? Did you make a new user on a server? If that's the case, the question is misleading. – TheNomad Sep 04 '21 at 20:48

2 Answers2

1

There is no UI to set the picture of a different specific user, but you can do it by creating versions of the picture with all necessary sizes and modifying the Registry to point to them. Specifically, each user's account picture is stored under this key as described in this other answer:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AccountPicture\Users

Each subkey's name is the SID of the user whose picture it specifies. Each subkey has a handful of Image### entries, one for each image size, e.g. Image32, storing the full path to the image. The most recent Windows 10 version has entries for 32, 40, 48, 64, 96, 192, 208, 240, 424, 448, and 1080 pixels. When you create an account picture with the Settings app, the images are stored in a subfolder of C:\Users\Public\AccountPictures named for your SID. The files should be readable by Everyone. Strangely, both the subkeys and subfolders allow full control only to the singular Administrator account instead of the Administrators group, so writing to them requires adjusting the ACL, after taking ownership in the case of the folder.

To automate this process, I wrote a PowerShell script based on this forum post:

Param(
    [string]$UserName,
    [string]$PicturePath
)

# Get identifiers for path components
$sid = [System.Security.Principal.NTAccount]::new($UserName).Translate([System.Security.Principal.SecurityIdentifier]).ToString()
$pictureGuid = [guid]::NewGuid().ToString().ToUpper()

# Load the new image
Add-Type -AssemblyName System.Drawing
$picture = [System.Drawing.Image]::FromFile((gi $PicturePath).FullName)

# Create or gain access to the AccountPictures subfolder
$picturesFolder = Join-Path (Join-Path $env:PUBLIC 'AccountPictures') $sid
If (Test-Path $picturesFolder) {
    Push-Location $picturesFolder
    takeown /f . /a | Out-Null
    icacls . /grant 'Administrators:(OI)(CI)F' | Out-Null
    Pop-Location
} Else {
    mkdir $picturesFolder | Out-Null
    Push-Location $picturesFolder
    icacls . /grant 'Everyone:(OI)(CI)R' | Out-Null
    Pop-Location
}

# Create or gain access to the picture Registry key
$picturesKey = Join-Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AccountPicture\Users $sid
If (Test-Path $picturesKey) {
    $keySubpath = "SOFTWARE\Microsoft\Windows\CurrentVersion\AccountPicture\Users\$sid"
    $keyObject = [Microsoft.Win32.RegistryKey]::OpenBaseKey('LocalMachine', 'Registry64').OpenSubkey($keySubpath, 'ReadWriteSubTree', 'ChangePermissions')
    $acl = $keyObject.GetAccessControl()
    $acl.AddAccessRule([System.Security.AccessControl.RegistryAccessRule]::new('Administrators', 'FullControl', 'ContainerInherit', 'None', 'Allow'))
    $keyObject.SetAccessControl($acl)
    $keyObject.Dispose()
} Else {
    mkdir $picturesKey | Out-Null
}

# Prepare the JPG encoder
$encoder = [System.Drawing.Imaging.ImageCodecInfo]::GetImageEncoders() | ? { $_.MimeType -eq 'image/jpeg' } | select -First 1
$encoderParams = [System.Drawing.Imaging.EncoderParameters]::new()
$encoderParams.Param[0] = [System.Drawing.Imaging.EncoderParameter]::new([System.Drawing.Imaging.Encoder]::Quality, 90)

# Create resized versions of the picture
(32, 40, 48, 64, 96, 192, 208, 240, 424, 448, 1080) | % {
    $picturePath = Join-Path $picturesFolder "{$pictureGuid}-Image$_.jpg"
    $resized = [System.Drawing.Bitmap]::new($_, $_)
    $graphics = [System.Drawing.Graphics]::FromImage($resized)
    $graphics.InterpolationMode = [System.Drawing.Drawing2D.InterpolationMode]::HighQualityBicubic
    $graphics.DrawImage($picture, 0, 0, $_, $_)
    $resized.Save($picturePath, $encoder, $encoderParams)
    $resized.Dispose()
    Set-ItemProperty $picturesKey -Name "Image$_" -Value $picturePath
}

It takes the account name of the user whose picture to change and the path to the picture. The picture can be in any common format, but should be square since it will be stretched to square dimensions. The script appropriately configures the folder and Registry key, creates the several resized versions of the picture, and writes their paths to the Registry. Changes frequently take effect immediately, but if you don't see them, reboot.

To use run the script, save it as a PS1 file, e.g. accountpicture.ps1. If you haven't already, follow the instructions in the Enabling Scripts section of the PowerShell tag wiki. You can then run the script from an administrative PowerShell prompt like so:

.\accountpicture.ps1 -UserName newuser -PicturePath .\photo.png
Ben N
  • 40,045
  • 17
  • 140
  • 181
0

Can I also set account picture for him?

Log in as him then do the following:

Change Your Picture in Settings app in Windows 10

  1. Do step 2 or step 3 below depending on how you would like to open Your account settings.

  2. Open Settings, click/tap on the Accounts icon, and go to step 4 below.

  3. Open the Start menu, click/tap on your account at the top left, click/tap on Change account settings, and go to step 4 below.

    enter image description here

  4. Browse and Choose Your Picture

    • Click/tap on Browse under Your picture. (see screenshot below)

    enter image description here

    • Navigate to and select the image you want, click/tap on Choose picture,

    enter image description here

  5. Close Settings.

Source How to Change Your Account Picture in Windows 10

DavidPostill
  • 153,128
  • 77
  • 353
  • 394
  • 1
    @tgm1024 I deliberately left this answer in place as **it answer's the OP's original question before he edited it** and it may help future visitors to the site. There was no requirement about logging in mentioned in the original question. – DavidPostill Oct 27 '18 at 15:50
  • @Dims You changed the question **after** I answered. Please don't do this. – DavidPostill Oct 27 '18 at 15:53
  • @Dims I answered at Apr 4 '16 at 8:57. You edited your question at Apr 4 '16 at 9:16 to say "Note that the question is about how to set picture of a DIFFERENT user. So, the method including logging in as new user can not be regarded as an answer." which was after I had answered. – DavidPostill Oct 27 '18 at 20:33
  • 5
    @DavidPostill it was not a change of the question but emphasizing the aspect you ignored. If the question was not stating "different" user, I think I would accept it. – Dims Oct 27 '18 at 20:36
  • 5
    @DavidPostill, the question in its original form had "DIFFERENT" in the subject line, no? – tgm1024--Monica was mistreated Oct 28 '18 at 00:47