Søren Granfeldt PowerShell MA Export RRS feed

  • Question

  • Hello everyone!

    I have the following strange behavior with Søren Granfeldt PowerShell MA on Export:

    I am using CSEntryChange objects on Export, so i want to determine only changed values in multivalue attributes.

    Here is the example of export:

    To display changed values in debug file i am using following powershell code:

        $atrChng = $_.ChangedAttributeNames
        foreach ($can in $atrChng)
            "Name: $can" | Out-File $DebugFile -Append
            foreach ($ValueChange in $_.AttributeChanges[$can].ValueChanges)
                 $val = $ValueChange.Value
                 $valmodt = $ValueChange.ModificationType
                 "Value: $val $valmodt " | Out-File $DebugFile -Append

    In my debug file i have the following result:

    Name: members
    Value: u6000041 Add 
    Value: u6000042 Add 
    Value: u6000048 Add 

    This means that all attributes, even those that not have been changed are display as added attributes.

    I have an idea that this behavior is because of Object Replacement type export of this MA. If i am right, does this mean, that there are no ways for me to get only changed values instead of sort out all of them? In my case i should exactly know changed values to execute the target system API functions AddUserToGroup() or DeleteUserFromGroup() for each.

    The other option is that i am doing something wrong :)

    Thanks in advance for any help!

    Friday, June 27, 2014 6:21 AM

All replies

  • It is configured to do object replacement currently. However, if you - as it looks like you done - deselect the "Export Simple Objects" on the MA, you should be able to get the the AttributeChanges property on the exported CSEntryChange object - and go from there using the MSDN documentation for this type of object (

    Remeber that the AttributeChanges consists of a list objects of type AttributeChange, which again have some properties (i.e. ValueChanges) that you may want to examine (

    You have to dig deeeeep...deeper that what you're doing with your current script. I have yet to go there...

    Regards, Soren Granfeldt
    blog is at | facebook | twitter at!/MrGranfeldt

    Sunday, July 6, 2014 6:43 PM
  • Hi, Soren!
    Thank you for your reply! I thought that i have examined everything about this property and tried different variations but nothing seems to work for me :) Anyway, Soren, thank you for your information, we will probably try some more options to solve this problem!

    P.S. The Microsoft PowerShell MA have the setting to set export type during its configuration, so the task described above is solving pretty simple when using it.

    Monday, July 7, 2014 4:30 AM
  • Yes, the MS version has that option. My version is a backward compatible as much as possible and the option to specify export type at runtime was added at a later FIM patch level than my MA was written for. I am considering a new version with a few more configuration options. However, time is not on my side currently.

    But I'm happy to get ideas and improvement suggestions on soren(at)


    Regards, Soren Granfeldt
    blog is at | facebook | twitter at!/MrGranfeldt

    Friday, July 18, 2014 7:47 AM