DeleteObject

Applies To: Forefront Identity Manager 2010

This is an example of a Windows PowerShell function that creates an ImportObject object based on an ID and a FIM object type that represents the object to be deleted from the FIM Service. For more information, see FIM Windows PowerShell Cmdlet Examples.

DeleteObject Function

# States
# 0 = Create
# 1 = Put
# 2 = Delete
# 3 = Resolve
# 4 = None

function DeleteObject
{
    PARAM([string]$TargetIdentifier, $ObjectType = "Resource")
    END
    {
        $importObject = New-Object Microsoft.ResourceManagement.Automation.ObjectModel.ImportObject
        $importObject.ObjectType = $ObjectType
        $importObject.TargetObjectIdentifier = $TargetIdentifier
        $importObject.SourceObjectIdentifier = $TargetIdentifier
        $importObject.State = 2 # Delete
        $importObject
    }
}

Remarks

This is a basic function that can be reused by other functions in a Windows PowerShell script. Those functions must use the Import-FIMConfig cmdlet to commit the change to the FIM Service.

See Also

Concepts

FIM Windows PowerShell Cmdlet Examples
ModifyImportObject
CreateImportChange