How to display and Export information about office 365 users in office 365 by using powershell?

As an office 365 administrator, you would definitely need to display and export some user information such as distribution group list, all user list and mailboxes, license information and etc.
Most of those are cannot be manage from web portal or some are not convenient to manage on it.
So, the only way to do is "Powershell".
I've just collect some useful powershell command for displaying and exporting users information about office 365 users at below.



Display a list of office 365 Global Administrators
PowerShell command syntax: Get-MsolRoleMember –RoleObjectId .ObjectId | Select DisplayName,EmailAddress

For example  :Get-MsolRoleMember -RoleObjectId “Power Administrator”.ObjectId | Select DisplayName,EmailAddress

Display Different type of recipients with a specific Domain name (This is for the Administrator who need to administer more than one domain.)

Users UPN with a specific domain name suffix

PowerShell command syntax: Get-MsolUser –DomainName | ft -Property UserPrincipalName

For example  : Get-MsolUser -DomainName ictformyanmar.com | ft -Property UserPrincipalName

Display a list of user from a specific department

PowerShell command syntax: Get-msoluser | Where {$_.Department -eq ""}

For example  : Get-msoluser | Where {$_.Department -eq "Mrkt"}

Display list of services assigned to user

PowerShell command syntax: Get-msoluser -all | ForEach-Object { "============="; $_.DisplayName; $_.licenses[0].servicestatus }

Display list of users and their currently License

PowerShell command syntax: Get-MsolUser | Where-Object {$_.isLicensed -eq "TRUE"} | select Displayname, Licenses

Export list of users and their currently License to a file

PowerShell command syntax: Get-MsolUser | Where-Object {$_.isLicensed -eq "TRUE"} | select Displayname, Licenses < Path & File Name>

For example : Get-MsolUser | Where-Object {$_.isLicensed -eq "TRUE"} | select Displayname, Licenses > c:\temp folder\Licenses.txt

Export information about office 365 users mailbox to CSV file

PowerShell command syntax: Export list of all Mailboxes Get-mailbox | Export-Csv < Path & File Name>

For example : Get-mailbox | Export-Csv c:\temp folder\allmailboxes.csv

Export list of all office 365 users
PowerShell command syntax: Get-MsolUser | select DisplayName,FirstName,LastName,UserPrincipalName,MobilePhone,PhoneNumber,Office,Fax,StreetAddress,PostalCode,City,Country,State,Department, IsLicensed ,PreferredLanguage , Title , UsageLocation | Export-Csv < Path & File Name>

For example : Get-MsolUser | select DisplayName,FirstName,LastName,UserPrincipalName,MobilePhone,PhoneNumber,Office,Fax,StreetAddress,PostalCode,City,Country,State,Department, IsLicensed ,PreferredLanguage , Title , UsageLocation | Export-Csv c:\temp folder\allmailboxesusage.csv

Export list of all office 365 users with License
PowerShell command syntax: Get-MsolUser | Where-Object {$_.isLicensed -eq "TRUE"} | Export-Csv < Path & File Name>

For example : Get-MsolUser | Where-Object {$_.isLicensed -eq "TRUE"} | Export-Csv c:\temp folder\userslicenses.csv

Export list of all office 365 users without License
PowerShell command syntax: Get-MsolUser -UnlicensedUsersOnly | Export-Csv < Path & File Name>

For example : Get-MsolUser -UnlicensedUsersOnly | Export-Csv c:\temp folder\userswithoutlicense.csv

Export list of all Distribution Groups
PowerShell command syntax: Get-DistributionGroup | Export-Csv < Path & File Name>

For example : Get-DistributionGroup | Export-Csv c:\temp folder\listofdg.csv

I'll write about some more powershell commands for exchange online and other useful for office 365 if I've got time.

May you all be happy.
(Be knowledgeable, pass it on then)

2 comments

It's very useful article with informative and insightful content and i had good experience with this information.Enroll today to get free access to our live demo session which is a great opportunity to interact with the trainer directly which is a placement based Salesforce training India with job placement and certification . I strongly recommend my friends to join this Salesforce training institutes in hyderabad practical course, great curriculum Salesforce training institutes in Bangalore with real time experienced faculty Salesforce training institutes in Chennai. Never delay to enroll for a free demo at Salesforce training institutes in Mumbai who are popular for Salesforce training institutes in Pune.

Reply

I have recently found an excellent Salesforce Training in India whose faculty is exceptional and you can also try this Salesforce Training and Certification in Jaipur whose syllabus is state of art. Here at Salesforce Training in Mumbai instructors are perfect to teach salesforce crm. My advice for you is to join demo at Salesforce training in Pune | Course Cost and in weekends try this best Salesforce Training in Noida | Course Cost who is providing great teaching services on Salesforce Training in Delhi and Fee Details.

Reply

Post a Comment