FIM ScriptBox Item

Summary

How to use PowerShell to List the sets of a user in the FIM Portal or MIM Portal. This example takes advantage of the FIM Service to perform the limiting and searching of data as close to the source as possible as opposed to pulling all of the data locally and looping through it several times or even running additional queries against the FIM Service.

Script Code

001

002

003

004

005

006

007

008

009

010

011

012

013

014

015

016

017

018

019

020

021

# How to Use PowerShell to show to which sets user belongs by David Lundell Identity Managed LLC

#----------------------------------------------------------------------------------------------------------

 set-variable -name URI -value "http://localhost:5725/resourcemanagementservice' " -option constant 

#----------------------------------------------------------------------------------------------------------

  

$UserDisplayName = Read-Host "Enter the display name of the user"

if(@(Get-PSSnapin | ? { $_.Name -eq "FIMAutomation" } ).Count -eq 0)

{

 Add-PSSnapin FIMAutomation; 

} 

$Filter = "/Set[/ComputedMember=/Person[DisplayName='" + $UserDisplayName + "']]"

$Sets = Export-FIMConfig -customConfig $Filter -Uri $URI -OnlyBaseResources

$Sets.count

foreach ($Set in $Sets)

{ 

 ($Set.ResourceManagementObject.ResourceManagementAttributes | Where-Object {$_.AttributeName -eq "DisplayName"}).Value

}

 

note Note
To provide feedback about this article, create a post on the FIM TechNet Forum.

For more FIM related Windows PowerShell scripts, see the  FIM ScriptBox

 

See Also