Table of Contents

FIM ScriptBox Item

Summary

This script lists the Display Name of users that were already registered into the FIM Portal by FIM Password Reset Registration Client and exports it to a CSV File.
The script queries a WorkFlow called "Password Reset AuthN Workflow" and returns its ObjectID, then uses it to do a new query searching for "Users" with these parameters:
AuthN WorkFlow Registered = ObjectID of "Password Reset AuthN Workflow"

Script Code 

001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017
018
019
020
021
022
023
set-variable -name URI -value "http://localhost:5725/resourcemanagementservice' " -option constant 
set-variable -name CSV -value "RegistredResetPassUsers.csv" -option constant

clear 

If(@(Get-PSSnapin | Where-Object {$_.Name -eq "FIMAutomation"} ).count -eq 0) {Add-PSSnapin FIMAutomation} 

$WFDFilter = "/WorkflowDefinition[DisplayName='Password Reset AuthN Workflow']" 
$curObjectWFD = export-fimconfig -uri $URI –onlyBaseResources -customconfig ($WFDFilter) -ErrorVariable Err -ErrorAction SilentlyContinue 
$WFDObjectID = (($curObjectWFD.ResourceManagementObject.ResourceManagementAttributes | Where-Object {$_.AttributeName -eq "ObjectID"}).value).split(":")[2]
$Filter = "/Person[AuthNWFRegistered = '$WFDObjectID']"
$curObject = export-fimconfig -uri $URI –onlyBaseResources -customconfig ($Filter) -ErrorVariable Err -ErrorAction SilentlyContinue 

[array]$users = $null 
foreach($Object in $curObject) 
{
 $ResetPass = New-Object PSObject
 $UserDisplayName = (($Object.ResourceManagementObject.ResourceManagementAttributes | Where-Object {$_.AttributeName -eq "DisplayName"}).Value)
 $ResetPass | Add-Member NoteProperty "DisplayName" $UserDisplayName
 $Users += $ResetPass
}

$users | export-csv -path $CSV

 

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