Skip to content

Instantly share code, notes, and snippets.

@chrisbrownie
Created October 24, 2017 10:06
Show Gist options
  • Save chrisbrownie/64308287054add2b7e55c37b2282ddad to your computer and use it in GitHub Desktop.
Save chrisbrownie/64308287054add2b7e55c37b2282ddad to your computer and use it in GitHub Desktop.
$AllUsers = Get-Mailbox -ResultSize unlimited
$AllUsers | % {
$_.UserPrincipalName
$PhotoData = $null
$PhotoData = Get-UserPhoto -Identity $_.UserPrincipalNAme -ErrorAction SilentlyContinue
if ($PhotoData) {
[io.file]::WriteAllBytes("$pwd\$($_.UserPrincipalName).jpg",$Photodata.PictureData)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment