Forum Discussion
How to load managers for differents users from a csv file on Office 365 through Powershell?
- Jan 31, 2018
It's a very simple task, all you need to do is use the Set-User cmdlet against the CSV file. For example:
Import-CSV blabla.csv | % { Set-User $_.UserPrincipalName -Manager $_.Manager }
where it is assumed that you have the blabla.csv file with column UserPrincipalName, uniquely designating the user, and column Manager.
It's a very simple task, all you need to do is use the Set-User cmdlet against the CSV file. For example:
Import-CSV blabla.csv | % { Set-User $_.UserPrincipalName -Manager $_.Manager }
where it is assumed that you have the blabla.csv file with column UserPrincipalName, uniquely designating the user, and column Manager.
Hi Vasil,
Thanks for the answer.
Not sure why but the UserPrincipalName option is not available.
First, you need to put the headers in the csv file like below, separated by comma
Identity,Manager andy.k,BigBoss
Once done, I've amended the script a bit
Import-CSV blabla.csv|%{Set-User $_.Identity -Manager $_.Manager}
Cheers