ConvertResourceToHashtable

Updated: May 27, 2010

Applies To: Forefront Identity Manager 2010

This is an example of a Windows PowerShell function that converts an ExportObject object that represents a FIM resource into a hash table. For more information, see FIM Windows PowerShell Cmdlet Examples.

ConvertResourceToHashtable Function

function ConvertResourceToHashtable
{
    PARAM([Microsoft.ResourceManagement.Automation.ObjectModel.ExportObject]$ExportObject)
    END
    {
        $hashtable = @{"ObjectID" = "Not found"}
        foreach($attribute in $exportObject.ResourceManagementObject.ResourceManagementAttributes)
        {
            if ($attribute.IsMultiValue -eq 1)
            {
                $hashtable[$attribute.AttributeName] = $attribute.Values
            }
            else
            {
                $hashtable[$attribute.AttributeName] = $attribute.Value
            }
        }
        $hashtable
    }
}

Remarks

The hash table that this function creates can be converted back into a resource by the ConvertHashtableToResource function. You can use this function as a helper function in a Windows PowerShell script that performed bulk export operations from the FIM Service database.

See Also

Community Additions

ADD
Show: