Creating and Migrating Users via Powershell

This topic contains 0 replies, has 1 voice, and was last updated by Profile photo of Forums Archives Forums Archives 5 years, 5 months ago.

  • Author
    Posts
  • #6557

    by galene at 2012-11-08 18:07:09

    Note: This is for provisioning accounts in Office365, so figured I'd post it here in case there's something specific in O365 account creation and migration compared to normal Exchange or just general file manipulation.

    Hey,

    So I'm trying to create and manage my users via powershell. So the first thing I have is just a simple account creation script that takes a CSV, and creates accounts with it using New-MSolUser. Works well so far. The next thing I'm trying to do is create a migration batch for an IMAP server. To do this I need a CSV with EmailAddress,Username,Password. I have all of those things in that initial CSV. The issue is the initial CSV does not have both e-mail address and username. (they're the same) And it also has a number of unnecessary columns that new-migrationbatch chokes on if it sees.

    So how do I take a CSV that has "FirstName,LastName,EmailAddress,DisplayName,Password,Title,Department,Office,OfficePhone,MobilePhone,Fax,Address,City,State,ZIP,Country,License" and get just "EmailAddress,UserName,Password" (Username is a duplicate from EmailAddress) into another CSV file.. or otherwise able to be handled by New-MigrationBatch?

    by DonJ at 2012-11-09 12:28:58

    Import-CSV startingpoint.csv | select -property emailaddress,@{n='Username';e={$_.emailaddress}},password | export-csv newfile.csv

You must be logged in to reply to this topic.