0

I have a script to list all the users that have accounts on sharepoint. However, not all them are being listed. There are only 5/8 Marks that are listed for example.

I'm using powershell and a query:

"<Query><OrderBy><FieldRef Name='ID' /></OrderBy></Query>"

I don't know why there are not all showing. I can find them under the portal and admin center.

3 Answers 3

2

Users are added to the User Information List when they login to the site or granted specific permissions (not through an AD Group).

You can read more on SharePoint.StackExchange.com at How is the user information list populated?

2

You can write a PowerShell script(named ListWebUserInformationListItems.ps1) as following:

# Run with SharePoint 2010 Management Shell
$webUrl = Read-Host "Enter the web url"
$web = Get-SPWeb $webUrl
$list = $web.Lists["User Information List"]
$query = New-Object Microsoft.SharePoint.SPQuery
$queryCamlString = '<Query><OrderBy><FieldRef Name="Title" Ascending="True" /></OrderBy></Query>' 
$query.Query = $queryCamlString
$userInformationListItems = $list.GetItems($query)
foreach($userInformationListItem in $userInformationListItems)
{
    echo $userInformationListItem.Title
}

Then execute the script and input the web url when console window display the "Enter the web url" message.

Note: You can use SPQuery the get the User Information List items which are the users in this web application. The users are not all the users in the farm. And if you add a ADGroup to the SharePoint, you will add the only one SharePoint user to user information list(The SharePoint User stand for the ADGroup, the ADUser in the ADGroup will not present to the user information list).

The User Information List item title will display in the console window. enter image description here

More over: You can visit the "http://[your web application url]/_catalogs/users/detail.aspx" to view the users who are in the web application. enter image description here

Hope the answer will help you

1

I think you might get better of by listing all User Profiles instead. By doing this, you will at least get a list of all users that have been synchronized into SharePoint. Something like:

$site = Get-SPSite "your URL"
$context = Get-SPServiceContext $site 
$profileManager = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($context)
$profiles = $profileManager.GetEnumerator()

foreach($profile in $profiles)
{  
    $displayName = $profile.DisplayName  
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.