Running Management Agents Asynchronously from Powershell RRS feed

  • General discussion

  • 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.

    Friday, June 21, 2013 4:19 PM

All replies