So my customer has profile images for all users in AD (used for Lync and 
Outlook) and wants to leverage them for User Profile Images on machines with 
win8 (8.1).
Has anyone come across an automated way of setting profile images on a per user 
basis?

I have been able to pull the image out of AD and save it to a file on the 
client, but have not been able to find a method to set it as the active image.

My preferred method would be to run this as a user PowerShell login script, 
since I don't want users to be able to change the image to something whacky.

The code below searches AD for the user object, and saves the image blob to a 
file (if it exists).

$username=$env:username
$domain=$env:userdomain
$pictures=[Environment]::GetFolderPath("MyPictures")
 $path="$pictures\$domain+$username.jpg"
$photo = 
([ADSISEARCHER]"samaccountname=$($username)").findone().properties.thumbnailphoto
if($photo -eq $null)
{
exit
}
else
{
$photo | set-content $path -Encoding byte



Christopher Catlett
Consultant | Detroit
[MCTS_2013_small]

Sogeti USA
Office 248-876-9738 |Fax 877.406.9647
26957 Northwestern Highway, Suite 130, Southfield, MI 48033-8456
www.us.sogeti.com<http://www.us.sogeti.com/>


<<inline: image001.jpg>>

Reply via email to