Now that we have seen why it's important
to have the user profile field, let's take
a look at how we can report on user
profile completeness. We are now in the
lab environment, so let me open up the
PowerShell ISE. The first thing that we
need to do is connect to all of the
required services, and here in this
particular demo, I have connected to some
services that we have not covered in this
course. However, because it's important to
give you an idea about the whole user
profile, including the Azure AD one, it's
important to cover all of them, but if you
want to learn more about PowerShell and
the other Office 365 services, there's a
PowerShell for Office 365 course on
Pluralsight. But back to this demo, I have
connected to Exchange Online, Sharepoint
Online, and PnPOnline, so Sharepoint
Online using the PnP module, and then
Azure Active Directory. Now let's take a
look at one that has to do with
SharePoint, which is the AboutMe. The
first thing that I will do is I will do a
Get‑AzureADUser exactly like we did in the
slides where the userType is Member and
AssignedLicenses is not Null. Then I will
create an empty array called
NoAboutMeUsers. And then I will look
through all of the users. In order to get
the user profile because the AboutMe is
only a SharePoint Online property and not
an Azure AD one, we're going to look
directly into the
Get‑PnPUserProfileProperty and look into
the userPrincipalName, and I have an
ErrorAction SilentlyContinue. Why do I
have this is because that user might be
licensed. However, they might not have
ever logged into SharePoint, or it might
be a brand‑new user, and they might not
have the SharePoint Online user profile
yet. So I just have an if here if the
profile is not Null. Then I will look in
the SharePoint profile, so the variable
that I got. UserProfileProperties AboutMe
is nothing, and if it's nothing, it means
that user doesn't have an AboutMe, so I'll
just add it to the array. And at the end,
I will export everything to a CSV file. So
let me just go into see Office 365
reports, and I will have the
UsersWithNoAboutMe in CSV format so that
makes it easy to open with Excel, and I
will have the DisplayName and
UserPrincipalName. Now let's take a look
at some other ones. Remember, you're going
to be able to have access to all of them
as part of the demo downloads of this
course. The Manager one that we have shown
in the slides, it's
Get‑AzureADUserManager. The Picture one
because, as we have mentioned in this
course, the picture is stored in Exchange
Online, so we actually have to look in
Exchange Online. So I'm using the
Get‑UserPhoto PowerShell cmdlet. The logic
is the same for every single one of those
scripts. So every single one of those
scripts gets all of the users that are a
member and not licensed, looks through
them, looks at that specific property, and
if it's not there, if it's empty, we're
going to add it to an array and export it
to CSV. Projects is in SharePoint, so I
have it here. Skills, as well as in
SharePoint properties, SPS‑Skills. One
that's important because remember that we
have looked during the past demo that the
cell phone is not automatically synced
from Azure AD to Sharepoint. So for the
cell phone, we actually have to look in
both Azure AD, so really looking in Azure
AD where the user.Mobile equals Null, as
well as looking to SharePoint where the
SharePoint profile
UserProfileProperties.CellPhone is
nothing. So you can use the script for
both out‑of‑the‑box properties, as well as
custom ones. I'm not going to run through
all of them because it's all the same
logic, and it's important that you
understand the logic, and you can play
around with the properties afterwards
because you have access to all of those
scripts when you download the exercise
files. This is it for user profile
completeness reporting using PowerShell.
Now let's go back to the slides and finish off this module.