#UPDATE 16. April 2013: Changed the PS script to write directly to binary attribute Picture in CS. Removing the need for rules extension. The new updates is uploaded in the zip file. Also remember to update your Schema file (example further down in this post)..
#UPDATE 29. April 2013 – Fixed bug on line 74. From FileDate to FileData.
Søren Granfeldt has done an amazing job creating a Powershell MA for FIM2010. We wanted to use this MA to import user pictures from a fileshare and into the FIM portal. When we got it in the FIM portal it is no problem exporting it to ex. Active Directory.
Our picture filenames was formatted like this: FULLNAME#ACCOUNTNAME.JPG (You can change the filter to your needs in our PowerShell script).
With the help of my good friend and colleague Didier Rossi (who is a master in pretty much everything, include cooking food). We jumped right into it. We`ll show you how we did it.
Prerequisite: As we are using WIA Object trough the Image PS module you have to Add the feature “Desktop experience” and run the “Windows Image Acquisition” Service under Windows Server 2008/R2.
#1 – Download and install the Powershell MA – REMEMBER to donate some to Søren`s great job!
#2 – Download PictureToFIM.zip
Remember to unblock the zip files before unzippping.
(Right click>Properties>Unblock content).
#3 – Now. We have to create three files. Export.ps1, Password-ChangeSet.ps1 and Get-Schema.ps1 I placed my files like this, for now. They are all empty files.
#4 – Unzip PictureToFIM.zip and copy the Import.ps1 to C:\FIMpowershellCode\AccessCardPictures
Copy the Image folder to: C:\Windows\System32\WindowsPowerShell\v1.0\Modules
#5 – Open up Get-Schema and paste the following:
You can of course change this how you like. Wanna learn more (http://blog.goverco.com/p/powershell-management-agent.html)
# Schema creation in FIM # Put this commands in a seperate file named schema.ps1 and call it from the Powershell MA. $obj = New-Object -Type PSCustomObject $obj | Add-Member -Type NoteProperty -Name "objectClass|String" -Value "user" $obj | Add-Member -Type NoteProperty -Name "Anchor-AccountName|String" -Value "IAMBLOGG" $obj | Add-Member -Type NoteProperty -Name "Picture|Binary" -Value 0x10 $ob
#6 – Re-open the FIM Synchronization service to get the new ma loaded.
#7 – Create a new MA “Powershell” and give it a nice name 🙂 I named mine “AccessCard Pictures”.
#8 – On the “Connectivity” tab, point to the location where you stored your schema file.
C:\FIMSchemaFiles\AccessCardPictures\Get-Schema.ps1 And give it your fimsync engine service account credentials.
#9 – Global Parameters: Point to your Import, Export and PasswordChange scripts.
We are only using the Import script in this MA, but we had to specify all three. (Not sure why) but I just created two empty files Export.ps1 and Password-ChangeSet.ps1. Use the “Export simple Objects”.
#10 – Configure Partitions and Hierarchies: default
#11 – Select Object Types: user (Depending on what you define in the schema file).
#12 – Select Attributes: AccountName, Picture (I only use these two in this version, change if you changed the schema file).
#13 – Configure Anchors: user AccountName (As my picture filenames include the accountname I use it as anchor).
#14 – Configure Connector Filter: None
#15 – Configure Join and Projection Rules: I made a join rule that joins on AccountName->accountName
#16 – Configure Attribute Flow: Create a new Direct flow rule with
CS attribute [Picture] import to MV attribute [photo]
#17 – Now. You should be able to import images into your metaverse.
Hope it serves you well! Enjoy!
– Remi and Didier