Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Update Active Directory Picture

$
0
0

Chaps.

I have pieced something together to update all users in an OU with a picture from a location. I have created a folder on the C:\ADPictures. Lets say I have a user with a SamAccountName of ABC then in C:\ADPictures there would be a ABC.jpg

Now I think I have something wrong with my foreach statement. Can anyone advise? Thanks in advance

foreach ($ADUser in (Get-QADUser -SearchRoot "OU-PATH HERE")) {
$ADPictures = "C:\ADPictures\"
$photo = [byte[]](Get-Content $ADPictures\$ADUser.jpg -Encoding byte)
Set-ADUser $ADUser -Replace @{thumbnailPhoto=$photo}
}


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>