Add-O365User

Add-O365User

Creates an account and assigns it to a local user account.

Syntax

Parameter Set: Default
Add-O365User [-LocalAccountName] <String> [-O365AccountUPN] <String> [-License <O365UserLicense[]> ] [ <CommonParameters>]

Detailed Description

The Add-O365User cmdlet creates an account and assigns it to a local user account.

Parameters

-License<O365UserLicense[]>

Specifies an array of licenses for the account.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-LocalAccountName<String>

Specifies the name of a local Active Directory user account. The cmdlet creates an account and assigns it to the local user account that you specify.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

True (ByValue)

Accept Wildcard Characters?

false

-O365AccountUPN<String>

Specifies a user principal name (UPN). The cmdlet creates an account that has the UPN that you specify.

Aliases

none

Required?

true

Position?

2

Default Value

none

Accept Pipeline Input?

True (ByValue)

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see    about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

  • System.String,System.String

    LocalAccountName
    Type: System.String
    Description: name of a local user account

    O365AccountUPN
    Type: System.String
    Description: user principal name

Outputs

The output type is the type of the objects that the cmdlet emits.

  • Microsoft.WindowsServerSolutions.O365Integration.O365User

    This cmdlet returns a class that represents an online account.
    When output: online account exists
    ObjectId Property System.Guid
    UserPrincipalName Property System.String
    Activated Property System.Boolean
    LocalUserName Property System.String
    Licenses Property System.Collections.ObjectModel.ReadOnlyCollection<O365UserLicense>

Examples

Example 1: Create an office_365_2 account

This command creates an account named Admin@Contoso.onmicrosoft.com and assigns it to the local user account named Admin.

PS C:\> Add-O365User -LocalAccountName "Admin" -O365AccountUPN "Admin@Contoso.onmicrosoft.com"
PS C:\> 

Get-O365User

Enable-O365User

Disable-O365User

Remove-O365User