This project is read-only.

.SYNOPSIS

Executes a Run Profile on a FIM Management Agent

.DESCRIPTION

Uses WMI to call the Execute method on the WMI MIIS_ManagementAgent Class

PARAMETER ManagementAgentName

Management Agent Name

PARAMETER RunProfile

RunProfile Name to execute

PARAMETER RunProfileList

List of Management Agent Names and Run Profile Names

PARAMETER StopOnError

Throw an exception if the MA does not return 'success'

PARAMETER AsJob

Run the Management as a PowerShell Job

.EXAMPLE

Run the FIM management agent 'Export' run profile.
Start-ManagementAgent FIM Export

.EXAMPLE

Run two management agents concurrently, then wait for them both to finish.
Start-ManagementAgent myReallyBigMAOne 'FullImport' -AsJob
Start-ManagementAgent myReallyBigMATwo 'FullImport' -AsJob
Get-Job | Receive-Job

.EXAMPLE

Run the 'AD' management agent three times, using three different run profiles. This script will NOT stop if any of the run profiles hit errors.
@(
    ('AD','DISO (redmond)'),
    ('AD','DISO (bronte)'),
    ('AD','DISO (nantucket)')
) | Start-ManagementAgent

.EXAMPLE

Run the 'AD' management agent three times, using three different run profiles. This script WILL stop if any of the run profiles hit errors.
@(
    ('AD','DISO (redmond)'),
    ('AD','DISO (bronte)'),
    ('AD','DISO (nantucket)')
) | Start-ManagementAgent -StopOnError

.EXAMPLE

Run three different management agents concurrently.
@(
    ('AD 1','DISO (redmond)'),
    ('AD 2 ','DISO (bronte)'),
    ('AD 3','DISO (nantucket)')
) | Start-ManagementAgent -AsJob

.EXAMPLE

Run a single MA, and handle any failures in a catch block. The Error object has some very interesting details.
try
{
    Start-ManagementAgent HoofHearted 'full import' -StopOnError
}
catch
{
    $_.TargetObject
}

.EXAMPLE

Run a bunch of MAs, and handle any failures in a single catch block.
try{
    Start-ManagementAgent CORP      'DISO (redmond)'     -StopOnError
    Start-ManagementAgent CORP      'DS (redmond)'       -StopOnError
    Start-ManagementAgent HOME     'DISO (All Domains) '-StopOnError

    ### FIM Export, Import and Sync
    Start-ManagementAgent FIM   	'Export'             -StopOnError
    Start-ManagementAgent FIM   	'Delta Import'       -StopOnError
    Start-ManagementAgent FIM   	'Delta Sync'         -StopOnError
}
catch
{    
    ### Assign the Exception to a variable to play with
    $maRunException = $_

    ### Show the MA returnValue
    $maRunException.FullyQualifiedErrorId

    ### Show the details of the MA that failed
    $maRunException.TargetObject.MaGuid
    $maRunException.TargetObject.MaName
    $maRunException.TargetObject.RunNumber
    $maRunException.TargetObject.RunProfile
}

.INPUTS

Inputs to this cmdlet (if any)

.OUTPUTS

String ReturnValue - returned by the Execute() method of the WMI MIIS_ManagementAgent Class

Last edited Aug 14, 2012 at 4:24 AM by CraigMartin, version 1

Comments

No comments yet.