> For the complete documentation index, see [llms.txt](https://docs.lithnet.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.lithnet.io/resource-management-powershell/v1.0/usage/cmdlet-reference/get-resource.md).

# 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](/resource-management-powershell/v1.0/usage/cmdlet-reference/search-resources.md) cmdlet.

### Syntax

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

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

```
Get-Resource -ObjectType <string> -AttributeValuePairs<Hashtable> [-AttributesToGet <string[]>] [-Locale <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

**Locale**

Optional. Specifies the language code of the culture to localize the representation of the resource in. This requires the appropriate language packs to be installed on the FIM/MIM Service. e.g en-US, de-de, ja-jp, es-es, it-it.

### Examples

**Get a resource by its object ID**

```powershell
Get-Resource -ID '7fb2b853-24f0-4498-9534-4e10589723c4'
```

**Get a Person using its AccountName attribute**

```powershell
$obj = Get-Resource -ObjectType Person -AttributeName AccountName -AttributeValue testuser
```

**Get a Person using a primary key attribute, returning selected attributes**

```powershell
# Get a Person using its AccountName attribute, and uses the AttributesToGet parameter to return 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**

```powershell
$obj = Get-Resource -ObjectType Person -AttributeValuePairs @{AccountName = "testuser"; Domain="fim-dev1"}
```

**Gets the localized representation of a resource**

```powershell
# Gets the display name of the "Display Name" attribute, in Italian
$obj = Get-Resource -ObjectType AttributeTypeDescription -AttributeName Name -AttributeValue DisplayName -Locale it-IT
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.lithnet.io/resource-management-powershell/v1.0/usage/cmdlet-reference/get-resource.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
