This project has moved. For the latest updates, please go here.

Get-Resource

Description

The Get-Resource cmdlet allows you retrieve a single object from the FIM Service.

Note, that this cmdlet will throw a TooManyResults exception if more than one object is returned from an anchor attribute/value pair search. To return multiple objects, use the Search-Resources cmdlet.

Syntax

Get-Resource -ID <object> [-AttributesToGet <string[]>]

Get-Resource -ObjectType <string> -AttributeName <string> -AttributeValue <object> [-AttributesToGet <string[]>]

Get-Resource -ObjectType <string> -AttributeValuePairs<Hashtable> [-AttributesToGet <string[]>]

Parameters

ID

Used to retrieve an object based on its object ID. This can be a string, a GUID, or a reference attribute obtained from another object

ObjectType

The name of the object type to query

AttributeName

The name of the anchor attribute to query with

AttributeValue

The value of the anchor attribute to query with

AttributeValuePairs

A hashtable of attribute and value pairs that uniquely identify the object

AttributesToGet

Optional. A list of attributes that should be retrieved for the object. If this value is omitted, then all attributes for the resource are returned

Examples

# Get a resource by its object ID
$obj = Get-Resource -ID 7fb2b853-24f0-4498-9534-4e10589723c4

# Get a Person using its AccountName attribute
$obj = Get-Resource -ObjectType Person -AttributeName AccountName -AttributeValue testuser

# Get a Person using its AccountName attribute, returning only the JobTitle attribute
$obj = Get-Resource -ObjectType Person -AttributeName AccountName -AttributeValue testuser -AttributesToGet JobTitle


#Get a Person using the AccountName and domain anchor pair
$obj = Get-Resource -ObjectType Person -AttributeValuePairs @{AccountName = "testuser"; Domain="fim-dev1"}

Last edited Aug 20, 2015 at 3:21 AM by ryannewington, version 2