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 enumurate 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 enumurate?
Are those 400 profiles are invalid? Even if those are invalid, it should say atleast those are invalid or null, am i right?
Update:
$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 envirnment.
We have configured the UPRE sync in the production, would that be an issue?
