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 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 nolvadex pct dosage havoc rat 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

Sterydy gdzie kupi, alpha pharma, shree venkatesh - sklep Losec mups 20 mg bijsluiter nolvadex

Nolvadex pct dosage havoc rat 7 - WSV Mannheim-Sandhofen eV
Nolvadex pct dosage havoc rat Dbol Cycle for Beginners (EXPERT GUIDE ) 4-Week
Nolvadex pct dosage havoc rat Buy Nolvadex (Tamoxifen) Online - STEROIDS - BUY - SALE - USA
Nolvadex pct dosage havoc rat Missmiis : Unable to to process your request when
Nolvadex pct dosage havoc rat M/search/posts
Nolvadex pct dosage havoc rat Adverse effects of drugs - Worst Pills
Nolvadex pct dosage havoc rat Le syndrome ent ropsychologique (Gut and Psychology)
Buy Balkan Pharmaceuticals BodyBuilding Steroids Online M - Underground Steroids Super Site Nolvadex Used On and Post Cycle - m Anabolics - m Common Side Effects of Nolvadex (Tamoxifen Citrate) Drug AAA Supplements - Bodybuilding Supplements Store
BUY NOW For Sale 70%!
buy viagra