Ask a questionAsk a question
 

General DiscussionUsing PowerShell to start a run profile

  • Friday, November 06, 2009 8:51 PMMarkus VilcinskasMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    #--------------------------------------------------------------------------------------------------
     set-variable -name MaName       -value "<MA NAME>"  -option constant 
     set-variable -name ProfileName  -value "<RUN PROFILE NAME"  -option constant
    $curMA = @(get-wmiobject -class "MIIS_ManagementAgent"`
    -namespace "root\MicrosoftIdentityIntegrationServer"`
    -computername "."`
    -filter "Name='$MaName'")
    if($curMA.count -eq 0){throw "MA not found"} write-host "`nStarting $ProfileName on $MaName" write-host "Result: $($curMA[0].Execute($ProfileName).ReturnValue)`n" #-------------------------------------------------------------------------------------------------- trap { Write-Host "`nError: $($_.Exception.Message)`n" -foregroundcolor white -backgroundcolor darkred Exit } #--------------------------------------------------------------------------------------------------

    Markus Vilcinskas, Knowledge Engineer, Microsoft Corporation