BUY NOW For Sale 70%!
buy viagra

{ }

I’ve just posted this script to the FIM Forum Scriptbox. It helped me do a bulk update of attributes in the FIM Portal that, for various reasons, I didn’t want to export through the Sync Service. I tried to make the script as flexible as possible, so it reads the attribute nolvadex 20 mg tablet android names from the header row of the CSV. I’ve only tested it wth single-valued string attributes so far.

While developing this script I came across an issue with the Import-FIMConfig cmdlet where it uses a cached copy of the FIM schema (and considering, in retrospect, how long it takes to export the schema, I’m not surprised it does this). If you’ve just added a new attribute to the schema you will need to restart your powershell session. The error I was getting was System.NullReferenceException (forum thread).


This script will update resources in the FIM Portal using values in a CSV file.

The CSV file must have the following:

  • A header row,
  • The first three columns must be as follows:
    • ObjectType – the resource type name as used in the Portal,
    • IDAttribute – the name of the attribute used to identity the target resource,
    • IDValue – that value of the attribute used to identify the target resource.
  • The remaining columns have the target Attribute Name from the FIM Portal as header.

For example:

ObjectType,IDAttribute,IDValue,Department,JobTitle Person,Email,,IT,Engineer Person,Email,,HR,Advisor


Script Code

PARAM($CSVFile,$FIMServer="localhost",$Delimiter=";",$LogFile="ImportCSV-Attributes.log") function GetAttribute { PARAM($exportObject,[string] $name) END { $attribute = $exportObject.ResourceManagementObject.ResourceManagementAttributes | Where-Object {$_.AttributeName -eq $name} if ($attribute -ne $null -and $attribute.Value) { $attribute.Value } } } function SetAttribute { PARAM($object, $attributeName, $attributeValue) END { $importChange = New-Object Microsoft.ResourceManagement.Automation.ObjectModel.ImportChange $importChange.Operation = 1 $importChange.AttributeName = $attributeName $importChange.AttributeValue = $attributeValue $importChange.FullyResolved = 1 $importChange.Locale = "Invariant" if ($object.Changes -eq $null) {$object.Changes = (,$importChange)} else {$object.Changes += $importChange} } } function WriteLog { PARAM($msg) END { Add-Content -Path $LogFile -Encoding ASCII -value $msg write-host $msg } } if (Test-Path $LogFile) {Remove-Item $LogFile} if(@(get-pssnapin | where-object {$_.Name -eq "FIMAutomation"} ).count -eq 0) {add-pssnapin FIMAutomation} $URI = "http://" + $FIMServer + ":5725/ResourceManagementService" # Parse CSV file. Note we're not using import-csv because we don't know what the column headers will be. $csv = Get-Content $CSVFile $header = $csv[0].split($Delimiter) $numcols = $header.length $rowcount = 1 while ($rowcount -lt $csv.length) { $rowvals = $csv[$rowcount].split($Delimiter) $filter = "/" + $rowvals[0] + "[" + $rowvals[1] + "='" + $rowvals[2] + "']" WriteLog -msg "Searching on $filter" $FIMObject = $null $FIMObject = export-fimconfig -uri $URI -customconfig ($filter) -ErrorVariable Err -ErrorAction SilentlyContinue if ($FIMObject.length -gt 1) {$FIMObject = $FIMObject[0]} $FIMObjectID = GetAttribute $FIMObject "ObjectID" $FIMObjectType = GetAttribute $FIMObject "ObjectType" if (($FIMObject -eq $null) -or ($FIMObjectID -eq $null)) { WriteLog -msg " Not found" } else { $bUpdateNeeded = $false # Create Import object that will update object in FIM $importObject = New-Object Microsoft.ResourceManagement.Automation.ObjectModel.ImportObject $importObject.ObjectType = $FIMObjectType $importObject.TargetObjectIdentifier = $FIMObjectID $importObject.SourceObjectIdentifier = $FIMObjectID $importObject.State = [Microsoft.ResourceManagement.Automation.ObjectModel.ImportState]::Put # Add the attributes $colcount = 3 while ($colcount -lt $rowvals.length) { $currentVal = $null $currentVal = $FIMObject.ResourceManagementObject.ResourceManagementAttributes | where-object {$_.AttributeName -eq $header[$colcount]} if ($rowvals[$colcount].length -eq 0) { $message = " No value to set for " + $header[$colcount] WriteLog -msg $message } elseif (($currentVal -ne $null) -and ($rowvals[$colcount] -eq $currentVal.Value)) { $message = " Value for " + $header[$colcount] + " is already correct" WriteLog -msg $message } else { $bUpdateNeeded = $true $message = " Setting " + $header[$colcount] + " to " + $rowvals[$colcount] WriteLog -msg $message SetAttribute -object $importObject -attributeName $header[$colcount] -attributeValue $rowvals[$colcount] } $colcount += 1 } # Import the changes into FIM if ($bUpdateNeeded) { WriteLog -msg " Importing changes" $importObject | Import-FIMConfig -uri $URI } } $rowcount += 1 }


Posted by Carol on. Filed under FIM 2010, powershell. Follow any responses to this post with its comments RSS feed. You can post a comment or trackback from your blog.


BUY NOW For Sale 70%!
buy viagra

Social Media And HIPAA : What You Need To Know Nolvadex d 20 mg bijwerkingen ritalin

Nolvadex 20 mg $30 tablet android Using powershell to update FIM Portal objects from a CSV
Nolvadex 20 mg $30 tablet android Missmiis : Using the MIMWAL to create Policy objects
Nolvadex 20 mg $30 tablet android BIRDS
Nolvadex 20 mg $30 tablet android Th
Nolvadex 20 mg $30 tablet android Cached
Nolvadex 20 mg $30 tablet android 8 10
Nolvadex 20 mg $30 tablet android Buy Nolvadex (Tamoxifen) without prescription. Cheap Nolvadex
Nolvadex 20 mg $30 tablet android Buy dianabol dbol credit card accepted - steroids - buy
Buy steroids UK next day delivery by PayPal cheap anabolic Conductor Cable - Copper Automatic Lightning Protection Dbol Cycle for Beginners (EXPERT GUIDE ) 4-Week Dianabol (Metandrostenolona Histria, Como Usar, Efeitos) Hoge bloeddruk Wat zijn jouw ervaringen? India - AstraZeneca
BUY NOW For Sale 70%!
buy viagra