Quantcast
Viewing all articles
Browse latest Browse all 21975

Exporting profile photos from Office365

Hello

I'm working on a powershell script in to parts.

Part 1 is to exporting user information data to a .csv fil - simple enough 

Part 2 is to find and exporting/downloading user/profile photos (thumphoto) as a .jpg format - this is where I get into trouble. I can get the data stream of the photo, but not the photo it self. Is there someway to exporting the photos in .jpg format?

Here is what I have so far:

#Login credential:
$username = "Username"
$password = "Password"
$secstr = New-Object -TypeName System.Security.SecureString
$password.ToCharArray() | ForEach-Object {$secstr.AppendChar($_)}
$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $secstr
#Create Connection
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $cred -Authentication Basic –AllowRedirection
#Download Exchange cmdlet into the session
Import-PSSession $Session
#User information data export to .csv
Get-User | Select-Object -Property UserPrincipalName, WindowsLiveID, MicrosoftOnlineServicesID, City, Company, CountryOrRegion, Department, DisplayName, FirstName, HomePhone, LastName, MobilePhone, Office, Pager, Phone, PostalCode, StateOrProvince, StreetAddress, Title, WindowsEmailAddress, Identity, Name  | Export-Csv -path "path\Export.csv" -Encoding "Default" -Delimiter ";"
#close session
Remove-PSSession $Session

#Get-Mailbox -ResultSize Unlimited | Where {$_.HasPicture -eq $True} | Sort-Object Name

It's not so pretty it could be but it's working.

It's Part to I need some help with, therefore I'm asking you to make me a script or input to making one.

Best regads

Thomas O Nielsen


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>