Bulk update objects in FIM/MIM based on CSV file

A customer asked me to make a script that allowed them to bulk update objects in MIM based on a csv file. The csv file itself would be created and updated using their favorite tool Excel.

Since they were already using the Lithnet PowerShell Module i decided to use that in my script.
This time I also decided to start sharing my scripts using my gist.github.com to make it easier to use for others.

The script I share with you does not have any errorhandling, and if you start using it you might want to add some.
I also intend to extend the script with ability to manage Reference and MultiValue attribute. If YOU feel thats a good idea, please comment on the Gist, and tell me the way you would like these to be represented in the csv file.

Hope you find this a useful tool in your FIM/MIM toolkit.

8 Replies to “Bulk update objects in FIM/MIM based on CSV file”

  1. Juan Carlos Canto

    Is it possible to use a powershell script to create Synchronization Rules, Workflows and MPR? based on CSV file?
    I have to create 100 MA for Unix Systems (SSH) and I have to create a SR, SET, WF and MPR set for each MA

    Thanks

    Reply
  2. Juan Carlos Canto

    Thanks for your answer. I have more questions than before 🙂

    I have several Unix Systems and I have one MA (SSH) for each Unix. I have to contemplate the case when one user in the portal will be provisioned to several Unix systems.
    There are few users in each Unix, so the amount of ERE should not be a problem.
    If I want to make a codeless provisioning, What should I do?
    Sorry, I’ve never use outbound scoping. I see the example of filter by employeeType, but in this case, What kind of filter should I use?
    Is it clear? Do you need more information? Thanks for your help

    Reply
    • Kent Post author

      Using Outbound Scoping is no more complex. The filter/criteria you were aiming to use for the Set usualy can be used as scoping filter in Sync Rule. If you need to support “deletes” in target systems you would need some code as the example I sent in last comment.

      One issue might be that the scoping filter does not support “or”, if you need that, use a Set. But instead of adding ERE update the user with some attribute value easy to use in the scope of sync rules during transition in to the Set.

      Reply
  3. Shray

    Is it possible to add bulk users in a set from CSV file? I am trying to find a PS script for the same,

    Reply
    • Kent Post author

      Hi Shray, yes it’s possible using a simple loop to get the users to add. Something like…(not tested the snippet below)
      $set = Search-Resources -xPath “/Set[DisplayName=’YourSet’]” -AttributesToGet ExplicitMember
      $users = # Imported from CSV
      foreach ($user in $users){
      $mimuser = Search-Resources -xPath (“/Person[AccountName='”+$user.AccountName+”‘]”
      $set.ExplicitMember.Add($mimuser)
      }
      Save-Resource $set

      Reply
  4. Mike Egan

    Kent,
    I am trying to get this script to work, but I keep getting “Get-Resource: Cannot bind argument to parameter ‘AttributeValue” because is is null. However, when I look at the values in the variable, the information is there. It doesn’t seem to like the value in ($Object.psobject.Properties | ?{$_.Name -eq $Anchor}).Value.

    Any suggestions where to look?

    Thank you,
    Mike

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *