Skip to main content

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)

Comments

  1. This is one of the best content for this topic and this is very useful for me. Thank you!
    Unix Training in Chennai
    Unix Course in Chennai
    Linux Course in Chennai

    ReplyDelete
  2. mazing post thanks for sharing this click here

    ReplyDelete
  3. "
    Salesforce is all about giving customers support and help. This keeps customers coming back and makes them happier and more loyal. It is different from other methods because it helps customers faster, pays attention to each customer's needs individually, and solves problems before they happen. Salesforce is one of the most influential CRM software. It supports companies to identify the potential customers for their business and collect the data to reach out to the customers securely. It also supports fixing client issues. It leads to improving the business sales and productivity. Salesforce implementation is a must for every company to grow their business. To know more about salesforce, Step into the Salesforce Training in Chennai at FITA Academy.

    For more information, Visit: Salesforce Training Online and Salesforce Training in Pondycherry | Salesforce Training in Coimbatore "

    ReplyDelete
  4. The Educational Testing Service administers the "Test of English as a Foreign Language" .It is a standardized test that evaluates a person's level of English proficiency, particularly for non-native English speakers, in the areas of reading, speaking, listening, writing, and comprehension. TOEFL is an important exam for students who want to do their higher education abroad; join TOEFL Coaching in Chennai to learn more about this exam. TOEFL Coaching in Chennai

    ReplyDelete
  5. SAS software is the first choice for the majority of businesses when it comes to data analytics. As a result of its features, support, and wide compatibility, SAS analytics can be simply incorporated into business operations. As a result of its visual information and data presentation, SAS is very simple for non-technical users.To learn more about SAS Software, join SAS Course in Chennai at FITA Academy.

    SAS Course in Chennai

    ReplyDelete
  6. React Native was developed to make the development of mobile apps easier after ReactJS. The answer is straightforward: life is made much simpler if you can create an app once in JavaScript and release it to both Android and iOS.Using JavaScript, you can create native mobile apps with the React Native framework. To learn more about react native, join react native course in chennai at FITA Academy.
    react native course in chennai
    React native online course

    ReplyDelete
  7. Any large company needs a human resources department to manage various tasks, including hiring new employees, conducting interviews, mediating conflicts, and overseeing existing employees' holiday pay, benefits, and payroll. There are several ways to enter the field of human resources. Still, the most reliable way to guarantee a job in this area is to complete an HR-specific education, such as a degree, postgraduate course, evening diploma, or online course. To learn more about human resource management, join the hr training in chennai at FITA Academy.

    hr training in chennai

    ReplyDelete

  8. A popular solution for creating cross-platform mobile apps is PhoneGap.An open-source framework for developing mobile applications was produced by Nitobi Software. It enables the creation of apps utilising HTML, JavaScript, and CSS by the developers. To learn more about PhoneGap, join phonegap course in chennai at FITA Academy. phonegap course in chennai

    ReplyDelete
  9. Goods and Services Tax is the name for GST. Indirect taxes like the value-added, service, purchase, excise duty, and others were replaced by this one, which was introduced to replace them all. In India, certain goods and services are subject to a tax known as GST. In India, there is only one type of tax. Join GST Classes in Chennai at FITA Academy to learn more about GST.
    GST Classes in Chennai

    ReplyDelete

  10. Swift is an open-source programming language created specifically for App Store software. It has a large community of iOS developers who work hard to advance the language's native development. Swift is a potent scripting language designed specifically for iOS applications. Its extensive selection of development tools makes it perfect for creating mobile applications.
    To learn more about swift, join Swift Developer Course In Chennai at FITA Academy.

    Swift Developer Course In Chennai

    ReplyDelete
  11. OMR Chennai is famous for being the city's primary IT and business district, often called the IT corridor. OMR, known for its thriving tech parks and proximity to the city, is home to modern Resorts In OMR Chennai that cater to both business and leisure travelers. If you're searching for a resort near me, OMR and ECR offer a variety of accommodations, making them ideal spots for weekend getaways or short stays.

    ReplyDelete

Post a Comment

Popular posts from this blog

Fortigate guide for Begineer - 6

I would like to explaine how to troubleshoot the Fortigate Unit configured by Transparent Mode in step by step this time. Let's assume, you have one Fortigate Unit that configured as Transparent Mode. But devices from Internal/Private Network unable to access Internet/Public Network through your Fortigate Unit. OK. Let's troubleshoot with following steps, 1) Check the physical network connections between the network and the FortiGate unit, and between the FortiGate unit and the Internet. 2) Check the router and ISP-supplied equipment to make sure it is operating correctly. 3) Verify that you can connect to the internal interface by connecting to the management IP address of the FortiGate unit from the Internal network. From the internal network, attempt to ping the management IP address. If you cannot connect to the internal interface, verify the IP configuration of the PC and make sure the cables are connected and all switches and other devices on the network are powered on a

Why do we need network virtualization?

We need to think about Server Virtualization first if we want to talk about Network Virtualization. In the era of cloud computing, servers are virtualized and used in Data Centers. We are facing a lot of problem when we virtualized our Servers, 1) Routing and Switching Problem Routing become the issue when we create Virtual Switch and VLANs according to production requirement. Network Team might need some time to change on their end to meet with Server Virtualization Team changes on their end. ၂) Firewall Services Physical Firewall are difficult to manage due to the large number of rules needed to satisfy business requirements. New applications, new projects, and new networks all come with potential security requirements, which impact centralized firewall management. ၃) Load Balancing Let's say your company deploys a new physical load balancer for each tenant, resulting in increased capital expenditures. Once a tenant reaches their maximum capacity, it ca

Solving "WSUS administration console was unable to connect to the WSUS Server via the remote API" error

Today, I've got below when I try to connect my WSUS Server via WSUS Console. Below logs are display in Event Logs too. The WSUS administration console was unable to connect to the WSUS Server via the remote API.  Verify that the Update Services service, IIS and SQL are running on the server. If the problem persists, try restarting IIS, SQL, and the Update Services Service. The WSUS administration console was unable to connect to the WSUS Server via the remote API. Verify that the Update Services service, IIS and SQL are running on the server. If the problem persists, try restarting IIS, SQL, and the Update Services Service. System.Net.Sockets.SocketException -- No connection could be made because the target machine actively refused it 172.16.99.98:80 Source System Stack Trace:    at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)    at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, S