Resource Management Powershell
Documentation Home
  • Home
  • Installation
    • Installing the PowerShell module
  • Configuration
    • Configuration management
    • ConfigSync File
    • Variables File
      • <Variables> element
        • <Variable> element
    • <Operations> element
      • <ResourceOperation> element
      • <AnchorAttributes> element
      • <AnchorAttribute> element
      • <AttributeOperations> element
        • <AttributeOperation> element
    • Building references
  • Usage
    • Cmdlet reference
      • Set-ResourceManagementClient
      • Get-Resource
      • Save-Resource
      • Search-Resources
      • Search-ResourcesPaged
      • Remove-Resource
      • New-Resource
      • Update-ResourceManagementClientSchema
      • Import-RMConfig
      • New-XPathQuery
      • New-XPathQueryGroup
      • New-XPathExpression
      • Get-ApprovalRequest
      • Set-PendingApprovalRequest
  • help and support
    • Quick reference guide
    • Working with different data and attribute types
    • XPath expression examples
Powered by GitBook
On this page
  1. help and support

Quick reference guide

The following code snippet shows the basic search, get, create and delete operations that are possible with the module

# Import the module
Import-Module LithnetRMA;

# Connect to the FIM service instance
Set-ResourceManagementClient -BaseAddress http://fimsvc:5727;

# Get a user by its account name
$obj = Get-Resource -ObjectType Person -AttributeName AccountName -AttributeValue ryan;

# Write all the attributes of the user to the screen
Write-Host $obj;

# Set a new value for the JobTitle attribute
$obj.JobTitle = "Tester";

# Save the changes to the Resource Management Service
Save-Resource $obj

# Search for a set
Search-Resources -XPath "/Set[DisplayName = 'Administrators']"

# Search for a set and return all attributes in the set object type
$set = Search-Resources -XPath "/Set[DisplayName = 'Administrators']" -ExpectedObjectClass Set
Write-Host $set

# Search for a set and return only the computed member and explicit member attributes in the set object type
Search-Resources -XPath "/Set[DisplayName = 'Administrators']" -AttributesToGet @("ComputedMember", "ExplicitMember")

# Delete a resource by a known ID
Remove-Resource 'cacfb5f3-4924-4b56-89ee-b6b0de3e36d5'

# Remove a resource by its reference using the pipeline
Get-Resource Person AccountName testuser | Remove-Resource

# Create a new user
$newObject = New-Resource -ObjectType Person
$newObject.AccountName = "testuser";
Save-Resource $newObject

# Get pending approvals
$pendingApprovals = Get-ApprovalRequest -Status Pending

# Approve pending approvals
Get-ApprovalRequest -Status Pending | Set-PendingApprovalRequest -Decision Approved -Reason "I said so!"

# Reject pending approvals
Get-ApprovalRequest -Status Pending | Set-PendingApprovalRequest -Decision Rejected -Reason "I said so!"
PreviousSet-PendingApprovalRequestNextWorking with different data and attribute types

Last updated 2 years ago