FIM ScriptBox Item

Summary

This script gets the attributes of a given object class and formats the output as a table.
Modify the parameters of the Format-Table CmdLet to display the attribute parameters you need.

Script Code

001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017
018
019
020
021
022
023
024
025
026
027
028
029
030
031
032
# get-object-attributes.ps1
# Prints the attributes of an object class formatted as a table.
# usage:
# get-object-attributes.ps1 [typeName <string>]

param(
 $typeName="Person"
)

Add-PSSnapin FIMAutomation -ErrorAction SilentlyContinue

# This filter is used to simplify the syntax to access object properties.
# For a detailed description check http://espace.cern.ch/idm/Lists/Posts/Post.aspx?ID=31
function PsExportObject() {
 process {
  $importObject = $_
  $psObject = New-Object PSObject
  foreach ($attribute in $importObject.ResourceManagementObject.ResourceManagementAttributes) {
   $name=$attribute.AttributeName
   if ($attribute.IsMultiValue) {
    $value=$attribute.Values
   } else {
    $value=$attribute.Value
   }
   Add-Member -InputObject $psObject -MemberType NoteProperty -Name $name -Value $value
  }
  $psObject
 }
}

$query="/BindingDescription[BoundObjectType=/ObjectTypeDescription[Name='$typeName']]/BoundAttributeType"
$attributes = Export-FIMConfig -CustomConfig $query -OnlyBaseResources | PsExportObject | Format-Table -AutoSize DataType,Multivalued,Name,DisplayName,Description

 

note Note
To provide feedback about this script, create a post on the FIM TechNet Forum.
For more FIM related Windows PowerShell scripts, see the FIM ScriptBox.

 



See Also