Skip to content

Add a filter to all Group criteria

Some FIM really REALLY annoys me, mostly when I come up against odd and unexpected limitations, but then I write a quick little PowerShell script to fix something or other and remember that this is really one of the best differentiators of the product. This quick fix came about because I realised that the group filters did not consistently use EmployeeStatus as a criterion, and with hundreds and hundreds of groups, there’s no way they could have been fixed manually.

. E:\scripts\FIMPowershell.ps1 #See http://technet.microsoft.com/en-us/library/ff720152(v=ws.10).aspx

$filter = "/Group"
$objs = Export-FIMConfig -OnlyBaseResources -CustomConfig $filter

foreach ($obj in $objs)
{
    $grpfilter = ($obj.ResourceManagementObject.ResourceManagementAttributes | where {$_.AttributeName -eq "Filter"}).Value
    $DisplayName = ($obj.ResourceManagementObject.ResourceManagementAttributes | where {$_.AttributeName -eq "DisplayName"}).Value
    $DisplayName

    if ($grpfilter)
    {
        if ($grpfilter.contains("EmployeeStatus = 'Active'")) 
        {
            "Skip"
        }
        elseif ($grpfilter.contains("not(EmployeeStatus = 'Inactive')")) 
        {
            "Change Inactive to Active"
            $grpfilter = $grpfilter.Replace("not(EmployeeStatus = 'Inactive')","EmployeeStatus = 'Active'")
            $ImportObject = ModifyImportObject -TargetIdentifier $obj.ResourceManagementObject.ObjectIdentifier -ObjectType "Group"
            SetSingleValue $ImportObject "Filter" $grpfilter
            $ImportObject | import-fimconfig
        }
        else
        {
            "Add filter"
            $grpfilter = $grpfilter.Replace("]</Filter>"," and (EmployeeStatus = 'Active')]</Filter>")
            $ImportObject = ModifyImportObject -TargetIdentifier $obj.ResourceManagementObject.ObjectIdentifier -ObjectType "Group"
            SetSingleValue $ImportObject "Filter" $grpfilter
            $ImportObject | import-fimconfig
        }
    }
}

 

{ 2 } Comments

  1. Peter Stapf | October 4, 2013 at 11:13 am | Permalink

    Nice script as always Carol, i’ve done this also shortly, have to create a Set,MPR combinition for Team Admins, this where around 150 Sets/MPRs, no one wants to click this through the Portal.

    And by the way thanks for all the other posts which helped me a lot to get were I am now.

  2. Carol | October 4, 2013 at 10:19 pm | Permalink

    Thanks for your nice comment Peter. I’ve done lots of automated creation of Sets and MPRs, and even Workflows (using XOML templates). You can even combine with the PowerShell activity to trigger these actions from changes in the Portal – works well!

Post a Comment

Your email is never published nor shared. Required fields are marked *

Spam comments will be blocked by Akismet

*

Endep online order order buy Endep online purchase Endep online without script buy generic Endep from india buy in Endep uk where to buy Endep without a prescription Endep from canada buy 10 mg Aricept generic Aricept cost order Nizoral no visa Nizoral 200 mg buy cheap Nizoral line Nizoral on line best finpecia online pill Requip Requip free Requip uk Amitriptyline generic buy generic Amitriptyline from india where buy Lisinopril purchasing finpecia with overnight delivery Nizoral online buy saturday delivery buy Nizoral in mo finpecia online how to buy Cytotec online without a rx order Aricept pharmacy buy Aricept with no prescription buy Amitriptyline no perscription cod Online us Requip how to buy Amitriptyline without a prescription buy line Amitriptyline buy Amitriptyline money buy purchase Accutane 40 mg on line no rx Accutane 40 mg sale order 40 mg Accutane online next day delivery 40 mg Accutane online buy Lisinopril pay cod Lisinopril overnight cod buy lisinopril without prescription buy lisinopril purchase Premarin cod next day delivery where buy Premarin buy Premarin online free fedex delivery Premarin cheapest place to buy Metformin purchase Metformin online generic 20mg prednisone online finpecia online overnight buy finpecia cheap buy Metformin toronto Metformin prescription buy Metformin where metformin purchased online without prescription buy metformin online cod purchase metformin money purchase order Metformin usa buy metformin cash on delivery buy online rx finpecia without fedex finpecia overnight without a prescription buy Metformin discount can i order finpecia onlinebuy finpecia cheap prednisone prescription cost Metformin canadian pharmacy buy cheap generic Metformin online lisinopril buy lisinopril