List of useful Office 365 commands :
1.To get the list of O365 users : get-msoluser
2.To create a new user: new-msoluser -UserPrincipalName test@vign.onmicrosoft.com -displayname “Test User”
3.To remove an existing user: remove-msoluser -UserPrincipalName kamalag@vign.onmicrosoft.com
4.To get the Office 365 license information : get-msolaccountsku
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}
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”
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 role: add-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”
One thought on “Part 1 : Useful Office 365 commands”