We would likely want to modify the CSV file or simply don’t want risking someone modifying the code or are not sure whether the other person is comfortable in changing the scripts. The Import-Csv is having the name of the Management Agent and run profile, If there is a need of additional MA to be add or change in the sequence of profile Run, we have to do the change in csv file only.

The format of the CSV file


SAPMA,Full Import

Test MA,Full Import

Test MA,Full Sync

The Code

#========================Run Profile==========================

function Runprofile($x,$y)


$MaName= "$x"


$curMA = @(get-wmiobject -class "MIIS_ManagementAgent"`

                          -namespace "root\MicrosoftIdentityIntegrationServer"`

                          -computername "."`

                          -filter "Name='$MaName'")



Import-Csv C:\Users\Administrator\Desktop\MA.csv |%{



Runprofile $x $y