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

[VOID][Reflection.Assembly]::LoadWithPartialName(“System.Windows.Forms”)
$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
$Form.Controls.Add($PictureBox)
$Form.Add_Shown({$Form.Activate()})
$Form.ShowDialog()

[wp_ad_camp_1]

Leave a Reply

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