The Microsoft Cloud Blog

Expert insights on Microsoft Azure, Cloud Architecture, and Enterprise Technology

SharePoint 2013: Get User Profile Properties via PowerShell

The following script will iterate through all the user profiles and return the account name.

Add-PSSnapin microsoft.sharepoint.powershell;

#Load SharePoint User Profile assemblies
[System.Reflection.Assembly]::LoadWithPartialName(“Microsoft.SharePoint”)
[System.Reflection.Assembly]::LoadWithPartialName(“Microsoft.Office.Server.UserProfiles”)

#Get Context
$serviceContext = Get-SPServiceContext -Site “[Site Name]”

#Instantiate User Profile Manager
$userProfileConfigManager = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($serviceContext);

#Get All User Profiles
$profiles = $userProfileConfigManager.GetEnumerator();

#Loop through all user profiles and display account name
foreach($profile in $profiles)
{
$profile.get_Item(“AccountName”);
}

Want more cloud insights? Listen to Cloudy with a Chance of Insights podcast:

Spotify | YouTube | Apple Podcasts

Like this article?

Comments

Loading comments...

Richard Hogan - Global Chief Architect, Microsoft Practice

Richard Hogan

Global Chief Architect, Microsoft Practice | IBM

Global Chief Architect, Microsoft Practice at IBM. 20+ years experience working at the intersection of cloud architecture, security, and emerging AI capabilities across Azure and the wider Microsoft ecosystem. Host of the Cloudy with a Chance of Insights podcast. Regular speaker at tech conferences and active contributor to the Microsoft Tech Community.

You might also like

SharePoint 2013: PowerShell to update a term sets Submission Policy

The following PowerShell can be used to update a terms sets submission policy to open or closed. #Connect to Central Admin $Session = new-object Microsoft.SharePoint.Taxonomy.TaxonomySession(“Central Admin URL”) #Connect to Managed Metadata Service $Store = $Session.TermStores[“Managed Metadata Service Name”] #Get the group $Group = $Store.Groups[“Group Name”]; #Get the Term Set $TermSet = $Group.TermSets[“Term Set Name”]; #Update… Continue Reading →

SharePoint 2013 Error: The filtering process has been terminated

I had just completed a PowerShell scripted deployment of a SharePoint farm and was just performing the final checks when I noticed the following error in the crawl logs. “The filtering process has been terminated” This turned out that because in the PowerShell script I had specified that the SharePoint installation location should be different to… Continue Reading →

Error: Specified value is not supported for the domainname parameter.

I came across the below error when trying to create a new web application via PowerShell against a 2013 farm. “Specified value is not supported for the domainname parameter error when creating web apps” This appears to have been caused by the machine loosing connectivity to the domain so even though my server was domain… Continue Reading →

Practical discussions on cloud engineering, architecture, and the reality behind the diagrams.

Bi-weekly reflections on cloud architecture, Azure, and the decisions teams wrestle with in practice.