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 test@vign.onmicrosoft.com -displayname “Test User”

new user

3.To remove an existing user: remove-msoluser -UserPrincipalName kamalag@vign.onmicrosoft.com

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 kamalag@vign.onmicrosoft.com -AddLicenses “vign:enterprisepack”

8. To remove license assigned to a specific user: set-msoluserlicense -UserPrincipalName kamalag@vign.onmicrosoft.com -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

msolgroup

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

msolrole

12. To add a user to a roleadd-msolrolemember -rolename “User Account Administrator” -rolememberemailaddress “testuser@vign.onmicrosoft.com”

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

password

Advertisement

One thought on “Part 1 : Useful Office 365 commands

Leave a Reply

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

WordPress.com Logo

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

Facebook photo

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

Connecting to %s