PowerShell: Import from CSV

You can Export information to a CSV File, so lets see how the Import from a CSV File works in PowerShell for Office 365.

Commandlet: Import-CSV -Path C:YourCSVfile.csv

If you read my article about Export-CSV we have a CSV with all our UserPrincipalNames or you can specify what to Select inside a CSV-file:

Command: Import-CSV -Path C:YourCSVfile.csv | Select UserPrincipalName

Combine that with a command against a user and it can be like this:

Command: Import-CSV -Path C:YourCSVfile.csv | Select UserPrincipalName | ForEach-Object | Set-MsolUser -UsageLocation NO

This will set UsageLocation to Norway for all users inside the CSV File.


One response to “PowerShell: Import from CSV”

Leave a Reply

Ehlo!

I am Roy Apalnes, a Microsoft Cloud Evangelist working av Sopra Steria. Main focus in Microsoft Security and Endpoint Management, with a bigger picture in mind.

Featured Posts

    %d bloggers like this: