FIM ScriptBox Item

Summary

The script list all Criteria-based groups and the filter.

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
024
025
026
027
028
029
030
031
032
##.\Group_export.ps1 | Out-File -filepath “C:\Groupexport\Group_export.txt” -append
if (@(get-pssnapin | where-object {$_.Name -eq "FIMAutomation"} ).count -eq 0)
{
 Add-PSSnapIn FIMAutomation
}
set-variable -name URI -value "http://svr2:5725/resourcemanagementservice"

Function GetAttribute
{
    Param($ExportObject, $AttributeName)
    End
    {
        $attributeValue = ($ExportObject.ResourceManagementObject.ResourceManagementAttributes | `
            Where-Object {$_.AttributeName -eq $AttributeName}).Value
        If($attributeValue -eq $null) {$attributeValue = ""}
        Return $attributeValue
    }
}


$exportObject = export-fimconfig -uri $URI `
                                 –onlyBaseResources `
                                 -customconfig "/Group[MembershipLocked = true]"

$exportObject | ForEach {
$displayName = GetAttribute -ExportObject $_ -AttributeName "DisplayName"
$filter = GetAttribute -ExportObject $_ -AttributeName "filter"
$filter = $filter.Substring(231)
$filter = $filter -replace "</Filter>", ""
$filter = $filter -split "="
($displayName + "~" + $filter)
}

 

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