Link to home
Create AccountLog in
Microsoft Excel

Microsoft Excel

--

Questions

--

Followers

Top Experts

Avatar of John Davies
John Davies🇬🇧

User Photo Bulk Upload
I am new to Powershell Scripting and Office365.

What I have is a pure cloud based solution, not hybrid and what I am looking for is an addition to this script that will bulk upload user photographs to their online profile.  As I have roughly 500 accounts to do I would like to this through a CSV file.

Thanks in Advance

Script

$userName = 'name'
$msolcred = New-Object System.Management.Automation.PSCredential($userName)
Get-MsolAccountSku
Get-MsolUser | Sort-Object -property DisplayName |Format-Table -AutoSize
$userfile = “c:\bulkuserupload.csv”
Import-Csv -Path $userfile | ForEach-Object {
   New-MsolUser `
    -FirstName $_.FirstName `
    -LastName $_.LastName `
    -UserPrincipalName $_.UserPrincipalName `
    -preferredLanguage $_.PreferredLanguage `
    -DisplayName $_.DisplayName `
    -LicenseAssignment $_.AccountSkuId `
    -UsageLocation $_.UsageLocation `
    -Title $_.JobTitle `
    -Department $_.Department `
    -StreetAddress $_.StreetAddress `
    -City $_.City `
    -State $_.State `
    -Country $_.Country `
    -PostalCode $_.PostalCode `
    -PhoneNumber $_.PhoneNumber `
    -Office $_.Office `
    -MobilePhone $_.MobilePhone `
    -Manager $_.Manager `
    -AlternateEmailAddresses $_.AlternateEmailAddresses `
    -Password “*******”
    } | Export-Csv -Path C:\Provisioned_users.csv -Append
write-host “Updated users”
Get-MsolUser | Sort-Object -property DisplayName |Format-Table -AutoSize

Zero AI Policy

We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.


ASKER CERTIFIED SOLUTION
Avatar of Vasil Michev (MVP)Vasil Michev (MVP)🇧🇬

Link to home
membership
Log in or create a free account to see answer.
Signing up is free and takes 30 seconds. No credit card required.
Create Account

Avatar of John DaviesJohn Davies🇬🇧

ASKER

Thank you very much for the helpful answer. Looks like fun....

Reward 1Reward 2Reward 3Reward 4Reward 5Reward 6

EARN REWARDS FOR ASKING, ANSWERING, AND MORE.

Earn free swag for participating on the platform.

Microsoft Excel

Microsoft Excel

--

Questions

--

Followers

Top Experts

Microsoft Excel topics include formulas, formatting, VBA macros and user-defined functions, and everything else related to the spreadsheet user interface, including error messages.