Part 1 : Useful Office 365 commands

List of useful Office 365 commands :

1.To get the list of O365 users : get-msoluser

msol user

2.To create a new user: new-msoluser -UserPrincipalName -displayname “Test User”

new user

3.To remove an existing user: remove-msoluser -UserPrincipalName

4.To get the Office 365 license information : get-msolaccountsku

msol accountsku

5.To get the details about the enterprise pack and the services included in it: Get-MsolAccountSku | Where-Object {$_.SkuPartNumber -eq “ENTERPRISEPACK”} | ForEach-Object {$_.ServiceStatus}

Enterprise pack

6. To get the details of the users and the license assigned to them : get-msoluser -all | ft displayname, licenses | Out-file “C:\userlicenses.csv”

Note : *Running this command will generate a csv file in the specified path  which has the details in it .

7. To assign license to a specific user : set-msoluserlicense -UserPrincipalName -AddLicenses “vign:enterprisepack”

8. To remove license assigned to a specific user: set-msoluserlicense -UserPrincipalName -RemoveLicenses “vign:enterprisepack”

9. To create a new security group: new-msolgroup -DisplayName “Groupname” -Description “Group Description”

New group

Note : *Specify the Groupname in the “Groupname” field and mention the group description in the “Group Description” field .In the above case “Vignesh” is the group name and “Desktop Technicians” is the group description.

10. To get the list of security groups: get-msolgroup


11. To get the list of roles in your tenant: get-msolrole


12. To add a user to a roleadd-msolrolemember -rolename “User Account Administrator” -rolememberemailaddress “”

13. To set a password for a user : set-msoluserpassword -UserPrincipalName “” -newpassword “P@ssw0rd2015”



One thought on “Part 1 : Useful Office 365 commands

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s