Show AD Picture

Nice script to visually show the content\value of the AD thumbnailPhoto property

$username = Read-Host ‘What is the username e.g. name.surname?’
$server = Read-Host ‘What is the userdomain e.g. domain1|domain2?’
$user = Get-ADUser $username -properties * -server $server

$Img = $User.thumbnailPhoto

$Form = New-Object Windows.Forms.Form
$Form.Text = “Image stored in AD for $UserName”
$Form.AutoSize = “True”
$Form.AutoSizeMode = “GrowAndShrink”
$PictureBox = New-Object Windows.Forms.PictureBox
$PictureBox.SizeMode = “AutoSize”
$PictureBox.Image = $Img


Leave a Reply

Your email address will not be published. Required fields are marked *