Quantcast
Channel: Microsoft Identity Manager forum
Viewing all articles
Browse latest Browse all 7443

Using PowerShell to enable provisioning

$
0
0
Summary
This script enables provisioning on your FIM server.
It only enables declarative provisioning.
If you need to enable non-declarative provisioning or both, you need to modify this script.

 

ImportantImportant
To use this script, you need to add the FIM service account to the FIMSyncAdmins group!

 

#----------------------------------------------------------------------------------------------------------
 set-variable -name URI -value "http://localhost:5725/resourcemanagementservice' " -option constant 
#----------------------------------------------------------------------------------------------------------
 if(@(get-pssnapin | where-object {$_.Name -eq "FIMAutomation"} ).count -eq 0) {add-pssnapin FIMAutomation}
 clear-host
 $exportObject = export-fimconfig -uri $URI `–onlyBaseResources `
                                  -customconfig ("/mv-data") `
                                  -ErrorVariable Err `
                                  -ErrorAction SilentlyContinue
 if($Err){throw $Err}
 if($exportObject -eq $null) {throw "There is no metaverse data configured on your system!"} 
 $provisioningState = ($exportObject.ResourceManagementObject.ResourceManagementAttributes | `
                      Where-Object {$_.AttributeName -eq "SyncConfig-provisioning-type"}).Value
 if(0 -ne [String]::Compare($provisioningState,"none", $true))
 {throw "L:Provisioning is already enabled"}

 $importChange = New-Object Microsoft.ResourceManagement.Automation.ObjectModel.ImportChange
 $importChange.Operation = 1
 $importChange.AttributeName = "SyncConfig-provisioning-type"
 $importChange.AttributeValue = "sync-rule"
 $importChange.FullyResolved = 1
 $importChange.Locale = "Invariant"
 $importObject = New-Object Microsoft.ResourceManagement.Automation.ObjectModel.ImportObject
 $importObject.ObjectType = $exportObject.ResourceManagementObject.ObjectType
 $importObject.TargetObjectIdentifier = $exportObject.ResourceManagementObject.ObjectIdentifier
 $importObject.SourceObjectIdentifier = $exportObject.ResourceManagementObject.ObjectIdentifier
 $importObject.State = 1 
 $importObject.Changes = (,$importChange)
 $importObject | Import-FIMConfig -uri $URI -ErrorVariable Err -ErrorAction SilentlyContinue
 if($Err){throw $Err}
 write-host "`nProvisioning enabled successfully`n"
#----------------------------------------------------------------------------------------------------------
 trap 
 { 
    $exMessage = $_.Exception.Message
    if($exMessage.StartsWith("L:"))
    {write-host "`n" $exMessage.substring(2) "`n" -foregroundcolor white -backgroundcolor darkblue}
    else {write-host "`nError: " $exMessage "`n" -foregroundcolor white -backgroundcolor darkred}
    Exit 1
 }
#----------------------------------------------------------------------------------------------------------

 

Go to the FIM ScriptBox


Markus Vilcinskas, Knowledge Engineer, Microsoft Corporation

Viewing all articles
Browse latest Browse all 7443

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>