Forum Discussion

Andy Kw's avatar
Andy Kw
Copper Contributor
Jan 31, 2018
Solved

How to load managers for differents users from a csv file on Office 365 through Powershell?

Hi,

I'm trying to update through powershell, the line managers,  which are in a csv format , of all the employees working in our company.

I know how to do it manually (see the 4 steps below)

 

1)

2)

 

3)

 

4)

But I'm clueless on how to do it by bulkload.

Update: I'm not looking for code rather for clues/links on how to do it.

 

Any tips are welcomed.

Cheers


PS: if my explanation was still unclear, please read this http://blog.goptg.com/blog/2011/09/06/set-up-manager-in-exchange-and-sharepoint-online-in-office-365


  • 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.

2 Replies

  • 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.

    • Andy Kw's avatar
      Andy Kw
      Copper Contributor

      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

Resources