How to Use Powershell to Import Schema Objects from a CSV File

How to Use Powershell to Import Schema Objects from a CSV File

FIM ScriptBox Item

Summary

This script may be used to create Attributes and Bindings in the FIM Portal Schema based on information in a CSV file.

The script comes in two parts:

  • Import-SchemaCSV.ps1 is used to generate a changes.xml file, and
  • CommitChanges.ps1 is used to import the changes into the FIM Portal.

If you are creating new attributes with bindings then you must run the process twice. The first time the attributes will be created, and the second time the bindings will be created, using the GUIDs of the new attributes.

The script does not currently create Resource objects. Any Resource types specified in the CSV file must already exist.

Usage:

  1. Fill in the CSV file. By default the script looks for "import.csv" - a different file name may be specified with the -File parameter. There is a sample import file in the download.
  2. Run Import-SchemaCSV.ps1. This will export the current FIM Schema and generate changes.xml.
  3. Backup your FIMService database.
  4. Run CommitChanges.ps1.
  5. Repeat from step 2 if you need to create bindings for new attributes.

Script Code

Please download using the following link. The package includes template files which must be located in the same folder as Import-SchemaCSV.ps1.

http://code.msdn.microsoft.com/Project/Download/FileDownload.aspx?ProjectName=FIMScriptbox&DownloadId=14871

 

note Note
To provide feedback about this script, create a post on the FIM TechNet Forum.
For more FIM related Windows PowerShell scripts, see the FIM ScriptBox.

 

Leave a Comment
  • Please add 8 and 4 and type the answer here:
  • Post
Wiki - Revision Comment List(Revision Comment)
Sort by: Published Date | Most Recent | Most Useful
Comments
  • Richard Mueller edited Revision 5. Comment: Replaced RGB values with color names in HTML to restore colors

  • Richard Mueller edited Revision 4. Comment: Removed (en-US) from title, added comment

  • Craig Lussier edited Revision 3. Comment: added en-US to tags and title

Page 1 of 1 (3 items)
Wikis - Comment List
Sort by: Published Date | Most Recent | Most Useful
Posting comments is temporarily disabled until 10:00am PST on Saturday, December 14th. Thank you for your patience.
Comments
  • Carol,

    Great script, I was just about to create one to do the same thing when I came across this one.  When you have over 70 custom attributes its alot easier to write a script than do it manually :)

    A couple of issues I had though

    1) the Sample csv file has a header of MultiValue where the script requires MultiValued ( addtional D )

    2) Also DateTime is not supported -       'DateTime' {$FIMAttrDataType = "DateTime"} needs to be added to the switch ($row.DataType) - at the moment if you specify DateTime in the CSV it seems to create the objects with the last attributes type :)

    Thanks for the script though very helpful

  • Craig Lussier edited Revision 3. Comment: added en-US to tags and title

  • Richard Mueller edited Revision 4. Comment: Removed (en-US) from title, added comment

  • Richard Mueller edited Revision 5. Comment: Replaced RGB values with color names in HTML to restore colors

Page 1 of 1 (4 items)