Save-Resource

Description

The Save-Resource cmdlet processes pending changes on resource objects obtained from the New-Resource, Search-Resources, and Get-Resource cmdlets, and submits them to the FIM service.

The Save-Resource cmdlet provides the ability to take objects from the pipeline and save them individually, as well as passing in an array of objects and processing them in a single composite operation.

Syntax

Save-Resource -Resources <PSObject[]> [-Parallel] [-Locale <string>]

Parameters

Resources

One or more resources returned from [New-Resource, [Get-Resource] or [Search-Resources] to save

Parallel

Optional. When this switch is used, the client will perform an update to the resources on multiple threads. It is recommended to pass in an array to the -Resources parameter, which will trigger a composite update instead.

Locale

Optional. Specifies the language code of the culture to save a localized 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

Save a single object

$obj = Get-Resource Person AccountName testuser
$obj.DisplayName = "Test User2"
Save-Resource $obj

Save multiple objects in a single composite operation

# Update the Location of multiple objects and save them as a single composite operation
$objs = Search-Resources "/Person[Location='Melbourne']" -AttributesToGet @("Location")
foreach($obj in $objs)
{
     $obj.Location = "Auckland"
}

Save-Resource $objs

Create and save new object

# Create a new resource template for the object type 'Person', populate some attributes, and save the new resource
$obj = New-Resource -ObjectType Person
$obj.AccountName = "newuser"
$obj.ExpiryDate = "2020-01-01T00:00:00.000"
$obj.ObjectSID = "AQUAAAAAAAUVAAAAFYLkaG79nJrWb05iFzcCAA==" #Base 64 encoded value
Save-Resource $obj

Update a localized value for a resource

$obj = Get-Resource AttributeTypeDescription Name DisplayName -Locale it-IT
$obj.DisplayName = "Nome visualizzato"
Save-Resource $obj -Locale it-IT

Last updated