Today, I have encountered another issue with SharePoint 2010. I have a powershell script that can pull the user profile details from the User Profile store, having used UserProfileManager to get the user profile details its shows the profile count as 75000 however if I enumerate the same object it gives me only 74600 user profiles. I have even tried with foreach and while loop to iterate the enum object howver the end result is same.

How the UserProfileManager Object shows the count as 75000 and the same object gives only 74600 profiles if I enumerate?

Are those 400 profiles are invalid? Even if those are invalid, it should say atleast those are invalid or null, am I right?


$site = Get-SPSite "http://mysiteurl"
$serviceContext = Get-SPServiceContext $site

$profileManager = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($serviceContext)
$userProfiles = $profileManager.GetEnumerator();

$UserCount = 1;

while($userProfiles.MoveNext()) {
$usrprofile = $userProfiles.Current;
$UserCount++ | out-file "E:\Temp\USP.txt" -append
$usrprofile["AccountName"]| out-file "E:\Temp\USP.txt" -append

$profileManager.Count gives 75000 however I could see only 74600 entries in the log file "D:\Temp\USP.txt"

What could be the issue? Even, I have verified the profile missed from import and it does not have more than few entries.

Any suggestions?

Update-2: The same code works perfectly in the QA environment. We have configured the UPRE sync in the production, would that be an issue?

  • by the way user profile service says 75000. – Karthikeyan Mar 4 '11 at 17:55
  • 1
    When you compare the actual differences what is different about the accounts? You mention the UPRE. Are the accounts from a different domain rather than your sync source? Are the accounts marked "missing from import"? – Matthew McDermott Nov 30 '11 at 15:00
  • I have reprovisioned the Sync DB and it solves the issue. – Karthikeyan Dec 1 '11 at 3:45
# List all user accounts that is not imported correctly (no email)
$upsa = Get-SPServiceApplication –Identity ID
Set-SPProfileServiceApplication $upsa -GetNonImportedObjects $true


Run the following jobs to delete My Sites and corresponding User Profiles

  • Dead Site Delete
  • My Site Cleanup Job

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.