This sample shows how to update a binary attribute in the FIM Service.

The Person object has a binary attribute in the default schema, and it renders nicely in the FIM Portal so acts as a good sample.

The only trick to this sample is loading the image file (a binary file) into a Base64 encoded string. Once you have that string you can easily use it in a FIM Import Change.

###
### Get the photo and Base64 Encode it
###
$bytes = Get-Content -Encoding Byte -Path 'C:\It-Works-On-My-Machine.jpg'
$profilePhoto = [Convert]::ToBase64String($bytes)

###
### Update the Person object's Photo attribute
###
New-FimImportObject -ObjectType Person -State Put -AnchorPairs @{AccountName='hoofhearted'} -Changes @{
    Photo = $profilePhoto
} -ApplyNow

Last edited May 6, 2014 at 6:47 PM by CraigMartin, version 1

Comments

No comments yet.