Office 365 Profile Completeness: Finding users with no country set in the user profile

Office 365 Profile Completeness: Finding users with no country set in the user profile

In Office 365, profile completeness is key to multiple cloud experiences. For example, you cannot really do approvals by the manager, if the manager is not set in the user’s profile! Another good example would be a people directory, which would be a bit useless if users don’t have their location and phone numbers filled in! In this series, we will look at how to use PowerShell to create a report of Office 365 Users missing key properties!

Finding users with no country

Office 365 Profile Completeness Series

Finding users with no country/ set in the user profile

In this blog post, we will focus on how to find users that do not have a Country set as part of their Office 365 Profile. The Country can be very useful for international company with more advanced people directories. It can also allow admins to create reports, or do changes by keying on this property.


The Script

First thing we are going to do is get our Office 365 credentials, and connect to Azure Active Directory.


I will then get all of the users in my tenant, that are internal to the company (Member) and that have at least one license assigned to them.

Next up, we will create an empty array in which we will later store our users without a country.

Now that we have all our information, we will loop trough each user, and find out if they have anything in the Country property of their Azure AD user profile. If not, we will add our user to the array!

Lastly, we will export the results to a CSV file

And here is the full script in one piece!

The Result

The final result is a CSV file in which we can see the display names and user names of all of the users in our tenant that don’t have the country in their profile! You can either contact them individually, or even Send Email from PowerShell in Office 365 in order to automatically send them a nicely formatted HTML e-mail asking them to fill it!

Finding users with no country

More Resources

PowerShell for Office 365 is an essential tool as part of every Office 365’s administrator toolbox. Without PowerShell, you cannot do cool reports such as the one in this blog post, and you are missing out on multiple Office 365 reporting, productivity and security settings. Here are some resources that you could use to learn PowerShell for Office 365:


Books are really ways to learn a topic from start to master, and even if they cost some dollars, they’re always a good investment!

Learn PowerShell for Office 365

Essential PowerShell for Office 365: Managing and Automating Skills for Improved Productivity
Take your Office 365 skills to the next level. Master PowerShell for Office 365 to stay competitive in today’s world of highly sought after cloud management skills. With expert guidance, IT pros will learn how to leverage the muscle of PowerShell to automate many advanced administrative tasks not otherwise accessible in the Office 365 Admin Center. You will discover how to unlock configuration options and automate tasks in order to free up valuable time and resources.

Get it on Amazon at the following links:

Video Training

NOTE: Pluralsight is a paid resource unlike Channel9, Youtube, and Microsoft Virtual Academy which are free. The quality they provide is also superior because of all the quality checks they go through, and the instructors are one of the best in the industry. The Pluralsight courses have a link to where you can get a free trial and decide for yourself if paying a subscription or not is worth it, but the 10 day free trial should allow you to view all those courses for free.

Learn PowerShell for Office 365

PowerShell for Office 365
In this course, you will learn how to use PowerShell to manage Office 365 services. You will learn how to connect and manage users and licensing, SharePoint Online, Exchange Online, Compliance Center and last but not least, Skype for Business Online.

Learn PowerShell for Office 365

PowerShell Playbook for Office 365
A more advanced look at multiple real-life scenarios that span across all Office 365 Services and show you how your PowerShell for Office 365 skills can be applied in your day to day life

PowerShell for common Office 365 Operations
In this 300 level session, you will learn how to automate the management of Office 365 using Windows PowerShell. We will discuss how to connect Windows PowerShell to Office 365, tour the Office 365 cmdlets, and demonstrate how to manage domains, users, and services including Exchange Online, and SharePoint Online.

Support Corner: Using PowerShell to Manage Office 365 Users
Join us in this fast-paced demo to learn how to manage Office 365 users using PowerShell. Experts show you how to create and delete users, update user IDs and passwords, assign licenses and groups, and much more.

Leave a comment and don’t forget to like the Absolute SharePoint Blog Page   on Facebook and to follow me on Twitter here  for the latest news and technical articles on SharePoint.  I am also a Pluralsight author, and you can view all the courses I created on my author page.
5/5 (3)

Please rate this


No comments yet.

Leave a Reply