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

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]

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.

Examples

# Save a single object
$obj = Get-Resource -ObjectType Person -AccountName testuser
$obj.DisplayName = "Test User2"
Save-Resource $obj

# 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 a 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

Last edited Apr 19, 2016 at 11:33 PM by ryannewington, version 3