Powershell:
param([String]$UserName)
$DefaultPhotoPath = “\\headstart.admin\share\redirect3\”
if (!$username) {
$UserName = "Username"
$UserName = Read-Host "Please place photo into" $DefaultPhotoPath"Username\ folder with naming format username.jpg and then type UserName into this script and press enter"
}
$DefaultPhotoPath = “\\headstart.admin\share\redirect3\” + $UserName + "\"
$PhotoPath = $DefaultPhotoPath + $UserName + “.jpg”
$photo = ([Byte[]] $(Get-Content -Path $PhotoPath -Encoding Byte -ReadCount 0))
Remove-UserPhoto $UserName -Confirm:$False
Set-UserPhoto -Identity $UserName -PictureData $photo -Confirm:$False
#Set-UserPhoto -Identity $UserName -Save -Confirm:$False
Last line commented out because it is no longer needed as of Exchange 2013 CU, CU3 I believe, but it could be an earlier CU. Uncomment if on and older build or if pictures don't actually populate.
No comments:
Post a Comment