Now let's talk a bit about reporting. We
have already talked about why the User
Profile is important so setting up reports
to make sure that the user profile
information is entered everywhere can be a
good administrative task to do, using
Microsoft tools, only PowerShell is really
the only reporting option. There are also
third-party tools out there that can do
it, but we won't cover this in this
course. We're really going to cover the
Microsoft way by using PowerShell. In
order to really access everything, you
need to have the SharePoint Online module,
Exchange Online module, Azure AD modules,
and the SharePoint PnP module. For the
module export, you can export it to CSV,
HTML, XML, or to really anything that
PowerShell works with, and if you want to
know how to do fancy reports with
PowerShell, there are a few cool courses
on Pluralsight on those topics. Now let me
give you an example in the slides and then
we'll do more in the demos. First of all,
let's say that we want to get all of the
users that do not have a manager. First of
all, I will get all of my users and save
them in a variable. I will filter where
the user type is Member. This means that
it's a user internal to the company and
not a guest, and where the assigned
license is not null. This way I don't get
accounts that are not using Office 365;
maybe those are service accounts or things
like that. We really want to focus on the
ones that have a license and of course,
you can customize it further according to
your needs. I will then initialize an
array called NoManagerUsers, which will be
an empty array, and next up, we will look
through each user that we got earlier and
get the manager of that user by using the
Get-AzureADUserManager PowerShell cmdlet.
If nothing is returned, so if the manager
is null, we will add the user to the array
that we have created earlier of users with
no manager. Lastly, we'll save the users
with no manager inside a CSV file for easy reporting.