Office 365 series Xi.: Bulk import of users using Windows PowerShell

Source: Internet
Author: User

In the nineth part of this series we have successfully managed the O365 platform through Windows PowerShell, providing a cushion for this bulk-import user. So for the O365 Platform Management PS Module installation today does not say so detailed, the specific configuration can refer to the ninth part of the content.


1.1 Install Microsoft Online Services sign-in Assistant for IT professionals RTW
http://www.microsoft.com/en-us/download/confirmation.aspx?id=41950

1.2 Install Windows PowerShell Azure Active Directory (up to a bit)
http://go.microsoft.com/fwlink/p/?linkid=236297


1.3 Run Windows PowerShell as an administrator, run the command "Import-module MSOnline" Import module

650) this.width=650; "title=" 1.png "alt=" wkiom1ukpuoyzjy9aaj9imm-npm395.jpg "src=" http://s3.51cto.com/wyfs02/M01/ 5d/d2/wkiom1ukpuoyzjy9aaj9imm-npm395.jpg "/>


1.4 Run the command "$Credential = get-credential" To create the credentials, enter the user name and password, click "OK"

650) this.width=650; "title=" 2.png "alt=" wkiom1ukpwbjt6j5aaefdgysxko162.jpg "src=" http://s3.51cto.com/wyfs02/M02/ 5d/d2/wkiom1ukpwbjt6j5aaefdgysxko162.jpg "/>


1.5 Run the command "Connect-msolservice-credential $Credential"

650) this.width=650; "title=" 3.png "alt=" wkiom1ukpzkyji0kaaihduzo_sa330.jpg "src=" http://s3.51cto.com/wyfs02/M00/ 5d/d2/wkiom1ukpzkyji0kaaihduzo_sa330.jpg "/>


1.6 Enter the command "Get-msolaccountsku" to get Accountskuid

650) this.width=650; "title=" 4.png "alt=" wkiol1ukpvpqxunoaagco8d0zys013.jpg "src=" http://s3.51cto.com/wyfs02/M00/ 5d/cd/wkiol1ukpvpqxunoaagco8d0zys013.jpg "/>


1.7 Create and edit the CSV file, after editing the user information (here you can specify the password) as follows:

650) this.width=650; "title=" 5.png "alt=" wkiol1ukpxrdblz1aav5ohnnm4q478.jpg "src=" http://s3.51cto.com/wyfs02/M02/ 5d/cd/wkiol1ukpxrdblz1aav5ohnnm4q478.jpg "/>

Note: This CSV file needs to be created and edited by yourself, and you can download CSV files and scripts from my cloud disk. The links are as follows:
Http://yunpan.cn/cfbLkzSbyDMDE Extract Code ab8d

Microsoft TechNet website Command Reference:
Http://technet.microsoft.com/library/jj151815.aspx


1.8 Open a CSV file in Notepad

650) this.width=650; "title=" 6.png "alt=" wkiol1ukp37xldyeaai3kwjgaw0396.jpg "src=" http://s3.51cto.com/wyfs02/M00/ 5d/cd/wkiol1ukp37xldyeaai3kwjgaw0396.jpg "/>


1.9 Save the file as "Unicode" encoding, click "Save" or the import will appear garbled

650) this.width=650; "title=" 7.png "alt=" wkiom1ukplaqxvmtaajbn4c09hy649.jpg "src=" http://s3.51cto.com/wyfs02/M00/ 5d/d2/wkiom1ukplaqxvmtaajbn4c09hy649.jpg "/>


1.10 Edit the script, note the green section of the CSV file path and just through the PS query Accountskuid

Import-csv-path "D:\NewAssignments.csv" | Foreach-object{new-msoluser-displayname $_. Displayname-userprincipalname$_. Userprincipalname-city $_. City-country $._country-department$_. Department-firstname $_. Firstname-lastname $_. Lastname-mobilephone$_. Mobilephone-office $_. Office-password $_. Password-phonenumber$_. Phonenumber-postalcode $_. Postalcode-state $_. State-streetaddress$_. Streetaddress-title $_. Title-usagelocation $_. Usagelocation-licenseassignment 'itlight:o365_business_premium'-passwordneverexpires$true- Forcechangepassword $False}


1.11 Run the above command,

650) this.width=650; "title=" 8.png "alt=" wkiom1ukpxohkkd3aap-wec6ejw042.jpg "src=" http://s3.51cto.com/wyfs02/M01/ 5d/d2/wkiom1ukpxohkkd3aap-wec6ejw042.jpg "/>


1.12 Return to the O365 Management Center, you can see the 2 users who have successfully imported 650) this.width=650; "title=" 9.png "alt=" wkiom1ukpvgskltsaalkaaiaqd8015.jpg "src=" Http://s3.51cto.com/wyfs02/M00/5D/D2/wKiom1UkpvGSKlTSAALKAaiaQd8015.jpg "/>


Through the above configuration to achieve through the introduction of PS O365 users, we can define the initial password according to the needs of the company, the next login needs to change the password and so on configuration. You need to be careful when editing a CSV file, and you can use the link above to download the template for modification. Share it here today and thank you for your support.


This article from "Bright Future" blog, declined reprint!

Office 365 series Xi.: Bulk import of users using Windows PowerShell

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.