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

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

Solving the "A general system error occured:Invalid fault" error in vSphere 4

Below error was come out when you try to migrate VM to other host for some reason. Below error was come out when you try to edit VM setting. Below error was come out when you power on the VM. How to solve those error? Here is how I resolve the error! Login to the Host that errored VM exist by using Terminal or Direct Console. Enter below command and press enter. services.sh restart Wait until all VMware Services are restarted. After that try to Power On/Edit Settings or Migrate the errored VM and you will see all you can do without any error pop-up. This kind of errors can occur if you shutdown/restart VM unproperly or shutdown/restart the Host unproperly that VM exist. You can check log file deeply if you willing to know precisely on this. May you all be happy. (Be knowledgeable, pass it on then)

Link Aggregating with Synology NAS and Cisco Switch

I’d like to share how to setup Link Aggregating between Synology NAS and Cisco Switch. I’ve got one Synology NAS with 4 Network Ports and I’m going to use 2 of them. Both Network Port to be as one Logical Link, Fault Tolerance and Load Balancing. To do that, I need to configure Link Aggregating on Synology NAS and EtherChannel with LACP on Cisco Switch. Below is brief steps to do to meet with my requirements. - Get connected Synology NAS and Cisco Switch as shown in picture. - Bonding two Network Ports of Synology NAS and assign IP Address - Configure EtherChannel with LACP in Cisco Switch and add two physical ports as Member. OK. Let’s begin from Synology NAS. - Login to the Synology and go to Control Panel>Network>Create>Create Bond - Select IEEE 802.3ad to get Fault Tolerance and Load Balancing Featureyou’re your switch not support 802.3ad you can only select Fault Tolerance only feature). After that click “Next”. - Choose the network port f