Pergunta

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

Foi útil?

Solução

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]
  }
}
Licenciado em: CC-BY-SA com atribuição
Não afiliado a sharepoint.stackexchange
scroll top