Programmatically setting user picture

A

Alex Lomas

Hi there,

I want to set the little display picture you see on the start menu and
logon screen via a logon script (or similar).

I can't really work out how to do this - it seems quite complicated. I
can see a .bmp file is created in C:\Users\%username%\Local Settings
\temp (filename domain+username.bmp) and also a .dat file in C:
\ProgramData\microsoft\User Account Pictures

The .dat file is always 32KB in size and isn't a .bmp in disguise, but
the last few octets of the file refer to the the file path that the
picture originally looked at. Process monitor seems to imply
imgres.dll is involved along the line, but this is really beyond my
experience now!

Does anyone have any 'official' way of setting this?

Cheers,

Alex
 
M

Mike Brannigan

Alex Lomas said:
Hi there,

I want to set the little display picture you see on the start menu and
logon screen via a logon script (or similar).

I can't really work out how to do this - it seems quite complicated. I
can see a .bmp file is created in C:\Users\%username%\Local Settings
\temp (filename domain+username.bmp) and also a .dat file in C:
\ProgramData\microsoft\User Account Pictures

The .dat file is always 32KB in size and isn't a .bmp in disguise, but
the last few octets of the file refer to the the file path that the
picture originally looked at. Process monitor seems to imply
imgres.dll is involved along the line, but this is really beyond my
experience now!

Does anyone have any 'official' way of setting this?

Cheers,

Alex

What would be the point of altering a picture by login script which will
fire after a user has logged on ?
 
A

Alex Lomas

What would be the point of altering a picture by login script which will
fire after a user has logged on ?

--

Mike Brannigan- Hide quoted text -

- Show quoted text -

Then it will be set for future logons (but logon script was just one
example mechanism, it doesn't matter where it runs, just whether it's
possible or not).
 
R

Ronnie Vernon MVP

Dan

You can do this. How you do it depends on which version of Vista you are
using.

If you are using Business or Ultimate, you can use the Group Policy Editor.

Press WINKEY+R to open the Run dialog. Type gpedit.msc and press OK.
Navigate to 'Computer Configuration/Administrative Templates/Control
Panel/User Accounts'.
Double click the 'Apply the default user logon picture to all users' policy.
Click the Enabled button.
Select Apply/OK
Exit the Group Policy Editor and rebott the system.

If you want to use a customized picture for the users, read the expanation
in this policy for the instructions.

If you are using either one of the Vista Home versions, you can set this
policy in the registry.

Go to Start and type regedit.exe in the search box.
In the results, right click regedit and select the 'Run As Administrator'
option.
In the registry editor, navigate to the following key.
HKLM\Software\Microsoft\Windows\CurrentVersion\Policies
Right click the Policies Key and select New/Key.
Name this key Explorer.
Click the new Explorer key.
In the right side pane, right click an empty space and select New/DWord
(32bit) Value.
Rename this value to UseDefaultTile (This name must be Case Sensitive)
Double click the new UseDefaultTile value and place a 1 (one) in the Value
Data line.
Click OK.
Exit the registry editor.
 
D

Dan

Thanks. That sort of worked, but now the picture doens't show up on the
user's start menu, only on the logon screen. The picture is blank for all
users when I go into control panel as well. When I remove this policy,
everything is fine.

Is this normal behavior? If so, how can I get around this? If not, any
suggestions?
 
R

Ronnie Vernon MVP

Dan

I'm not sure what would cause this behavior, but I was able to recreate what
you are describing.

I'll try and track down a fix, keep an eye out for a response in this
thread.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top