I'd like to have a list of all users with all of their user profile properties. How can this be done with PowerShell?

有帮助吗?

解决方案

This works for me. Also, you can check this post.

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue;
cls
$url = "http://sharepointsite/sites/dev"
$site = Get-SPSite $url
$context = Get-SPServiceContext $site
$profileManager = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($context)
$profiles = $profileManager.GetEnumerator()

while ($profiles.MoveNext()) {

  $userProfile = $profiles.Current 
  foreach($property in $userProfile.Properties)
  {
    Write-Host $property.Name --> $userProfile[$property.Name]
  }
}
许可以下: CC-BY-SA归因
scroll top