none
Get-UserPhoto script to save office 365 photo with email as file name RRS feed

  • Question

  • Hello, I have a script to download all users office 365 photos and It works but I want to save them with email as filename, this is the script

    get-mailbox | % {Get-UserPhoto $_.identity} | % {Set-Content -path "D:\export\$($_.Identity).jpg" -value $_.picturedata -Encoding byte}

    Monday, March 18, 2019 3:02 AM

Answers

  • Get-Mailbox | 
        ForEach-Object { 
            $photo = Get-UserPhoto $_.identity
            Set-Content -path "D:\export\$($_.UserPrincipalName).jpg" -value $photo.picturedata -Encoding byte 
        }


    \_(ツ)_/


    • Edited by jrv Monday, March 18, 2019 3:33 AM
    • Marked as answer by mpaul1986 Monday, March 18, 2019 11:32 PM
    Monday, March 18, 2019 3:28 AM