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

Running Management Agents Asynchronously from Powershell

$
0
0

Anybody have a good solution for running multiple Management Agents asynchronously from Powershell for Import operations?

My understanding is that you can run any number of Imports (not sync's) at any given time. If that's the case then running multiple Imports asynchronously would save time for things like Full Imports from a handful of Management Agents.

I was able to come up with this solution which leverages Powershell Jobs (since you can't really do any type of threading in Powershel), it seems to work ok.

#The names of all the Management agents in which you want to run a simultaneous Import (**NOT SYNC**)
$runList = @("FIM Service", "ADMA", "ADLDS", "SQL Server","GAL Sync")
$jobs = @()
$syncService = Get-WmiObject -Namespace "root\microsoftidentityintegrationserver" -class "MIIS_ManagementAgent"
$syncService | % { 
	$jobs += Start-Job -InputObject $_.__PATH -Name ($_.Name) -ScriptBlock {
		Invoke-WmiMethod -Path $input -Name Execute -ArgumentList "Full Import"
	}
}
#You can either do other stuff while the import runs, or wait for all of them to complete
$jobs | Wait-Job

Just curious if anyone has any other suggestions, improvements or ideas.


Viewing all articles
Browse latest Browse all 7443

Trending Articles



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