Forum Discussion
Marcus650
May 23, 2023Copper Contributor
Office 365 - trying to bulk update users in powershell from CSV
Can someone check this? I am trying to update multiple users via CSV. I am connected to the MsolService and using set-user to change the mentioned paramaters, and Im getting the error "Set-User : ...
May 23, 2023
try this
Import-Csv C:\M365\users.csv | foreach{Set-MsolUser -UserPrincipalName $_.UserPrincipalName -DisplayName $_.DisplayName -FirstName $_.FirstName -LastName $_.LastName -City $_.City -StreetAddress $_.StreetAddress -Department $_.Department -Country $_.Country -MobilePhone $_.MobilePhone}
Import-Csv C:\M365\users.csv | foreach{Set-MsolUser -UserPrincipalName $_.UserPrincipalName -DisplayName $_.DisplayName -FirstName $_.FirstName -LastName $_.LastName -City $_.City -StreetAddress $_.StreetAddress -Department $_.Department -Country $_.Country -MobilePhone $_.MobilePhone}