6

Is there a way to list specific user profiles instead all the users? Ex: List all the accounts starting with IT.

It should list all the users with ITUser1,ITUser2, ect....

The following script shows how to retrieve all user profiles. Thanks for any suggestions.

$mySiteUrl = "http://www.bing.com"

#Get site objects and connect to User Profile Manager service
$site = Get-SPSite $mySiteUrl
$context = Get-SPServiceContext $site
$profileManager = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($context) 
$profiles = $profileManager.GetEnumerator()

foreach ($up in $profiles) {

}
11

You can use the Where cmdlet to filter the users.

$profiles = $profileManager.GetEnumerator() | Where {$_.name -like "IT*"}

Note: This does the filtering after retrieving the full list.

Also

$profiles = $profileManager.GetEnumerator() | Where {$_.MultiloginAccounts -like "domainname\adminID*"}
| improve this answer | |
  • Thank you Ryan. I didn't have a chance to try it out until today, and it works. Here are the syntax: profiles = $profileManager.GetEnumerator() | Where {$_.MultiloginAccounts -like "domainname\adminID*"} – – user751119 Apr 18 '13 at 16:53
  • can you use use an arry – westerdaled Jun 16 '15 at 11:22

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.