Monday, November 5, 2018

Office 365 Profile Completeness: Finding users with no Picture 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!

Office 365 Profile Completeness Series

Finding users with no Picture set in the user profile

In this blog post, we will focus on how to find users that did not set their picture as part of their Office 365 profile. With remote work becoming more and more popular and with teams spread across the board, it’s important to be able to put a face on a name. Multiple Office 365 experiences such as Teams, Delve, SharePoint leverage that profile picture in order to make the tools you use look a lot better, and quickly identify people inside the company. Without pictures, all of those experiences will only show gray placeholders, which is not optimal.

There is no out of the box report on Profile Completeness in Office 365, so PowerShell is your best tool in creating reports on user’s profiles! Here is what we will need to get started:

Requirements:

The Script

First thing we are going to do is get our Office 365 credentials, and connect to both Azure Active Directory and Exchange Online!

$cred = get-Credential
Connect-AzureAD -Credential $cred
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $cred -Authentication Basic -AllowRedirection
Import-PSSession $Session

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.

$Users = Get-AzureADUser | Where {$_.UserType -eq 'Member' -and $_.AssignedLicenses -ne $null}

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

$NoPictureUsers = @()

Now that we have all our information, we will loop trough each user, and find out if they have a picture as part of their profile. If not, we will add that user object to the array we have created earlier!

foreach ($user in $Users) 
{
    $Picture = Get-UserPhoto -Identity $user.UserPrincipalName -ErrorAction SilentlyContinue
    if ($Picture -eq $null)
    {
        $NoPictureUsers += $user
    }
}

Lastly, we will export the results to a CSV file

$NoPictureUsers | Select DisplayName, UserPrincipalName | Export-Csv -Path "C:\O365Reports\UsersWithNoPicture.csv" -NoTypeInformation

And here is the full script in one piece!

$cred = get-Credential
Connect-AzureAD -Credential $cred
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $cred -Authentication Basic -AllowRedirection
Import-PSSession $Session

$Users = Get-AzureADUser | Where {$_.UserType -eq 'Member' -and $_.AssignedLicenses -ne $null}
$NoPictureUsers = @()

foreach ($user in $Users) 
{
    $Picture = Get-UserPhoto -Identity $user.UserPrincipalName -ErrorAction SilentlyContinue
    if ($Picture -eq $null)
    {
        $NoPictureUsers += $user
    }
}

$NoPictureUsers | Select DisplayName, UserPrincipalName | Export-Csv -Path "C:\O365Reports\UsersWithNoPicture.csv" -NoTypeInformation

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 a picture set 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!

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

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.

The post Office 365 Profile Completeness: Finding users with no Picture set in the user profile appeared first on Absolute SharePoint Blog by Vlad Catrinescu.


by Vlad Catrinescu via Absolute SharePoint Blog by Vlad Catrinescu

No comments:

Post a Comment