Wednesday, 13 May 2020

Display All the Owner of Group in FIM|MIM from a lists having the Groups Display Name


<# Summary : to pull all the group owner details in MIM
-- Anirban
#>
If(@(Get-PSSnapin | Where-Object {$_.Name -eq "FIMAutomation"} ).count -eq 0) {Add-PSSnapin FIMAutomation}
$group=Get-Content "C:\Path_of_the_Grouplists\Group.txt"
foreach($i in $group) {
$Dynamic = @()
$config=Export-FIMConfig -Uri http://localhost:5725 -onlyBaseResources -customConfig "/Group[DisplayName ='$i']"
$g=(($config.ResourceManagementObject.ResourceManagementAttributes | Where-Object {$_.AttributeName -eq "DisplayName"}).Value)
$e=(($config.ResourceManagementObject.ResourceManagementAttributes | Where-Object {$_.AttributeName -eq "Email"}).Value)
$o=(($config.ResourceManagementObject.ResourceManagementAttributes | Where-Object {$_.AttributeName -eq "DisplayedOwner"}).Value)
$own=(($config.ResourceManagementObject.ResourceManagementAttributes | Where-Object {$_.AttributeName -eq "Owner"}).Values)
$g
$e
$o
$own
$mem="$o".replace("urn:uuid:","")
$mem
# Query the email Address of the Displayed owner.
$config1 = Export-FIMConfig -Uri http://localhost:5725 -onlyBaseResources -customConfig "/Person[ObjectID='$mem']"
$em=(($config1.ResourceManagementObject.ResourceManagementAttributes | Where-Object {$_.AttributeName -eq "Email"}).Value)
$em
# Query the email address of the others owner.
foreach($j in $own)
{
$x = "$j".Replace("urn:uuid:","")
$config2 = Export-FIMConfig -Uri http://localhost:5725 -onlyBaseResources -customConfig "/Person[ObjectID='$x']"
$em1=(($config2.ResourceManagementObject.ResourceManagementAttributes | Where-Object {$_.AttributeName -eq "Email"}).Value)
$Dynamic+= $em1
}
"$g,$e,$em,$Dynamic" >>C:\Group_Report.txt
}



No comments:

Post a Comment

ServiceNow onboarding Sailpoint