FIM/ILM/MIIS Code Snippets

These code snippets are offered for inspiration only, and with no assertion that they are the best approaches. There is no guarantee that they will work unmodified in your environment.

Note if you have trouble with the code after copy-and-paste it is most likely the single- and double-quote characters, which may have been inadvertently changed during copy-paste.

FIM Workflow


BPOS Powershell Activity Run BPOS powershell cmdlets.
Updating WorkflowData from a custom workflow How to use WorkflowData parameters to pass information out of a custom workflow activity to the containing workflow.
Updating RequestStatusDetail How to write status messages to the RequestStatusDetail field of the Request object.
Passing data from a custom Workflow via the Request object How to write status messages to the Request object and then use them in a Notification activity’s Email Template.
Generate Unique Attribute Activity Generate a unique attribute value from a list of Function Evaluator rules, so if the first rule doesn’t find unique value the second will be tried etc.
Powershell Activity Run local or remote powershell scripts from a Workflow activity. The code project is linked at the bottom of the post.
The FIM 2010 Custom Logging Activity in VB.NET A reworking of the MSDN example which was published in VC#.

Metaverse Extensions (Provisioning Code)


OpenLDAP Provisioning How to create users with multiple objectClasses and an MD5 encrypted password.
Account Deprovisioning Scenarios Actually includes snippets from MV, MA and CS extensions, as all can be involved with disabling, disconnecting and deleting.
Managing Exchange 2000/2003/2007 with ILM 2007 Examples of provisioning Exchange users, contacts and distribution groups.
Getting Started with Provisioning Simple code examples
MVExtension.vb – AD, openLDAP and IIS Shows how provisioning to several different connector spaces can occur from the one MVExtension project. (Note the IIS part needs an XMA – code under CSExtenions below.)
Keep Provisioning Logic out of the Provisioning Code Simplify your provisioning code by moving decision making logic outside ILM

MA Extensions


Overcoming multiple personality disorder in the source data How to selectively flow from multiple connectors.
Importing groups from AD to the FIM Portal using classic flow rules Includes the IAF code for “scope” and “type”.
Phase One Joins and Data Matching Various examples of advanced join rules.
Advanced Joining Some more advanced join and resolution rules.
Advanced Attribute Flow Rules
Example of exporting Exchange quotas.
Adding Exchange 2003 Mailboxes to Existing Accounts Add a mailbox by populating attributes in export flow rules

Connector Space Extensions (XMAs)


Provisioning BPOS powershell commands as CS Objects An XMA which shows how individual powershell cmdlets can be run based on changes to Metaverse objects.
Remote Powershell Script XMA
An XMA which connects to a remote computer and uses powershell to fetch the data to be imported into the connector space.
Creating user home directories – Windows version An XMA to create user home folders right after creating the user account.
StaffWebsites_CSExtension.vb Creates IIS Virtual Directories for individual staff members.
An XMA to Create Apache Websites Calls shell scripts on a Linux server to create and delete the Apache websites. See the link at the bottom for the CSExtension code.

Password Extensions


FIM, the openldapXMA and MD5 passwords Modifying the openLDAP XMA so it syncs passwords as MD5 encrypted.
Password Sync from AD to BPOS Sync passwords to BPOS via the powershell interface.

Other VB.NET


Running Remote Powershell scripts from VB.NET How to run powershell scripts on a remote compter from VB.NET code.
XML Lookup file Move constants out of the extension code and into a lookup file.
ILM_Scheduler service A service which runs ILM and related jobs based on a queue in a SQL table.
DisplayActivityLog, DisplayQueue, DisplayDisables
Sub DisplayPendingExports
Build Export Menu
Componets of MiisApp – a home-grown client application for MIIS.



Improved export/import log archiving script and stylesheet Archives import/export logs to datestamped html files.
A script to create Sets and MPRs from Templates Replicates the structure of template Sets and MPRs, renaming and replacing template references.
A Script to make FIM Policy “Self-Documenting” Writes a list of MPRs using this Set/Workflow to Set/Workflow object.
Using powershell to update FIM Portal objects from a CSV Update any attribute on any object type from CSV file.
A simple powershell script to copy tables to another database Used at the end of run cycles to copy metaverse tables to a reporting database.
Modifying the FIM Portal Schema from a CSV Create Attributes and Bindings in the FIM Portal from data in a CSV file.
Three Different Ways to Create a BPOS Management Agent Powershell scripts used to extract data from BPOS to be imported into the Sync Service.
create-fimsecgroups.ps1 Bulk create Criteria-based Security Groups in the FIM Portal from a cvs file.
create-fimdistlists.ps1 Bulk create Manager-based Distribution Lists in the FIM Portal from a csv file.
Querying the FIM Metaverse using powershell SQL query from powershell.
A GALSync powershell script Create contacts in another forest based on users in this one (without FIM).



Archiving the Import and Export Logs, and viewing them with a stylesheet A vbscript to run after your Export and Import jobs, to archive the log files.
Archive_Mailboxes.vbs Archives Exchange 2007 mailboxes to PST, based on flags set in AD.
Function ExportsPending A function to include in a longer run profile script, that checks if any exports are pending before running the Export run profile.
Function DeltaImportsPending A function to include in a longer run profile check, that checks if a SQL delta table has any lines before running the Import.

SQL Queries


Metaverse SQL Queries Various queries to run against the metaverse and connector space tables, such as finding objects joined in one or more MAs.