Today, I am going to
create a CSV file and use it to create a bunch of users for my Office 365
installation. Now I just want to create a bunch of users.
To create a user in
Office 365 by using the Azure AD module, I use the New-MSOlUser cmdlet. The syntax for this looks an
awfully lot like the New-User cmdlet in the standard Active
Directory module. There are not quite as many options, but the process is very
similar. Here is the syntax for the New-MSOlUser cmdlet:
NAME
New-MsolUser
SYNOPSIS
Adds a new user to Windows Azure
Active Directory.
SYNTAX
New-MsolUser -DisplayName
<string> -UserPrincipalName <string>
[-AlternateEmailAddresses
<string[]>] [-AlternateMobilePhones <string[]>]
[-BlockCredential <Boolean>]
[-City <string>] [-Country <string>] [-Department
<string>] [-Fax
<string>] [-FirstName <string>] [-ForceChangePassword
<Boolean>]
[-ImmutableId <string>]
[-LastName <string>] [-LicenseAssignment <string[]>]
[-LicenseOptions
<LicenseOption[]>] [-MobilePhone <string>] [-Office <string>]
[-Password <string>]
[-PasswordNeverExpires <Boolean>] [-PhoneNumber <string>]
[-PostalCode <string>]
[-PreferredLanguage <string>] [-State <string>]
[-StreetAddress <string>]
[-StrongPasswordRequired <Boolean>] [-TenantId <Guid>]
[-Title <string>]
[-UsageLocation <string>] [<CommonParameters>]
To use the cmdlet,
it is as simple as filling in the blanks. Here is a quick example:
New-MsolUser -UserPrincipalName "ex@example.Com"
-City
Charlotte -State NC -Country USA -DisplayName
Scripting
In this command, I
did not assign a password. The cmdlet returns a user object, and that user
object includes a password. I could then pipe the information from the returned
object to Send-SMTPMail to send the user information and
password to the user. The cool thing is that I do not have to create a
password, nor do I have to supply one when I create the new user. Here is the
output from the command in the Windows PowerShell console:
When I go to the
Office 365 tenant admin site, I can see that the Scripting Wife user has indeed
been created:


No comments:
Post a Comment