Inserting photos in email id's

I am installed MS Exchange 2013 locally on windows 2012 server.

How to keep user photos.

Tried to keep in power shell, but unable to execute the command.

February 20th, 2015 6:28am

Any particular error you are getting when running the cmdlets?
Free Windows Admin Tool Kit Click here and download it now
February 20th, 2015 12:31pm

Hi Gentela,

Thank you for your question.

We suggest you send error to ibsexc@microsoft.com for our troubleshooting.

We will give a method by the following steps for you:

1. We could create a folder naming photos in C driver, then we copy the following script to photo folder and save as UpLoadPhoto.ps1 file:

param([Switch]$all, [String]$UserName)

#Default Values. Change them based on your environment.

$DefaultPhotoPath = 'C:\Photos'

Function CheckPhoto(){

 Write-Warning "Validating file(s).."

 Write-Host "File exists... " -nonewline

 If (Test-Path $PhotoPath)

 {

 Write-Host "[OK]" -ForeGroundColor Green

 Write-host "Photo size... " -nonewline

 $PhotoSize = Get-ChildItem $PhotoPath | select Length

 If ($PhotoSize.Length -le 10000) { Write-Host "[OK]" -ForeGroundColor Green }

Else { Write-Host "[Fail]" -ForeGroundColor Red; exit }

 }

 Else

 {

 Write-Host "[Fail]" -ForeGroundColor Red

 Exit

 }

}

Function UploadAll(){

 ForEach ($TempFile in Get-ChildItem $DefaultPhotoPath | Where-Object {

$_.Extension -eq ".jpg" } )

 {

  $TempUserName = $TempFile.Name.substring(0, $TempFile.Name.Length - 4)

  Write-Host $TempUserName -ForeGroundColor Yellow -NoNewLine

  Import-RecipientDataProperty -Identity $TempUserName -Picture -FileData ([Byte

[]]$(Get-Content -path $TempFile.Fullname -Encoding Byte -ReadCount 0))

  Write-Host "[Done]" -ForeGroundColor Green

 }

}

If ( $all -eq $true)

 {

 Write-Warning " ## This action will upload all pictures of C:\Photos to the AD

users."

 Write-Warning " ## All pictures must have the same name of the usernames"

 Write-Warning "Are you sure that you want upload all pictures to the users

(Y/N)?"

 $Opt = Read-Host

 If ( $Opt -eq 'y' ) { UploadAll; } Else { Write-Host "No changes were made.";

Exit }

 }

Else

 {

 $PhotoPath = $DefaultPhotoPaty + $UserName + '.jpg'

 CheckPhoto;

 If ( $AbortMission -eq '$true' ) { Write-Error "Please, review the errors and try

again." } Else { Import-RecipientDataProperty -Identity $UserName -Picture -

FileData ([Byte[]]$(Get-Content -path $PhotoPath -Encoding Byte -ReadCount 0)) }

 }

2. Then we could open cmd and navigate to C:\photo, and we could run the command of .\UpLoadPhoto.ps1 -all to upload all user photo. We could refer to the following snapshot:

Notice:

The script is based on the JPG file names. The username and file name must match, for example: Anderson (mailbox) and anderson.jpg (file) will work fine

The default folder that script uses to locate the JPG files is the C:\Photos. You can change that just by editing the Script and changing the $DefaultPhotoPath variable

If all pre-requisites are not met , the script will exit without doing any operation in Active Directory

Run the script through Exchange Management Shell 

3. Then we could check it in outlook.       

If there are any questions regarding this issue, please be free to let me know. 

Best Regard,

Jim

February 23rd, 2015 1:35am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics