locked
Using PowerShell to start a run profile RRS feed

  • General discussion

  •  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, Technical Content Developer, Microsoft Corporation
    Tuesday, July 14, 2009 12:42 PM
    Moderator

All replies

  • Here is a parameterized version that should also be remotable and is patterned after RunMA.vbs.  You would call like so:

    D:\RunMA.ps1 ADAM 'Delta Import'
    D:\RunMA.ps1 ADAM 'Delta Import' RemoteILMServer

    # RunMA.ps1
    # Accepts MAName and Run Profile Name with optional ILM Servername
    # Returns errorlevel 0 on success, 1 on any failure
    #
    # Setup the argument parameters 
    # Declare the default ILM server as local
    param([string]$MAName,[string]$RunProfileName,[string]$ILMServerName = ".")
    
    # Get the WMI Server object
    $curMA = @(get-wmiobject -class "MIIS_ManagementAgent" -namespace "root\MicrosoftIdentityIntegrationServer" -computername $ILMServerName -filter "Name='$MAName'") 
    # Validate that the MA exists
    if($curMA.count -eq 0){throw "MA not found"} 
    
    Write-Host "`nStarting $RunProfileName on $MAName"
    $Status = $($curMA[0].Execute($RunProfileName).ReturnValue)
    Write-Host "Result: $Status`n"
    #--------------------------------------------------------------------------------------------------
     trap 
     { 
        Write-Host "`nError: $($_.Exception.Message)`n" -foregroundcolor white -backgroundcolor darkred
        exit 1
     }
    #--------------------------------------------------------------------------------------------------
    
    if($Status -ne "success"){exit 1}
    RunMA.vbs always exits with a 0 for successes and 1 for failures, so this should be a direct replacement.
    Brad Turner, ILM MVP - Ensynch, Inc - www.identitychaos.com
    Wednesday, September 30, 2009 11:56 PM
  • Hi all, 

    Scenario - 2 forests with 2 way trust enabled, Task is to enable GAL Sync and Provision Lync from Central forest to User Forest. 

    Solution: - I have installed and configured FIM 2010 R2 in Central Forest, configured two Management agents for GAL Sync and 2 Management Agents for Lync Sync. This is working fine. 

    Problem:- In Synchronization Service GUI, I need to switch between .dll (GALsync.dll Lcssync.dll) for GAL Sync and Lync Sync respectively when i need to run a sync. I have automated Management Agents and their run profiles in PowerShell, but am not able to switch the .dll automatically. Is there a way to switch this .dll automatically using Powershell\WMI ??

    Thanks

    Shahid

    Shahid.a.shah@gmail.com(Primary Email)

    v-2shahs@hotmail.com(secondary Email)


    • Edited by v-2shahs Thursday, September 27, 2012 2:18 PM correction
    Thursday, September 27, 2012 2:15 PM
  • Scenario - 2 forests with 2 way trust enabled, Task is to enable GAL Sync and Provision Lync from Central forest to User Forest. 

    Solution: - I have installed and configured FIM 2010 R2 in Central Forest, configured two Management agents for GAL Sync and 2 Management Agents for Lync Sync. This is working fine. 

    Problem:- In Synchronization Service GUI, I need to switch between .dll (GALsync.dll Lcssync.dll) for GAL Sync and Lync Sync respectively when i need to run a sync. I have automated Management Agents and their run profiles in PowerShell, but am not able to switch the .dll automatically. Is there a way to switch this .dll automatically using Powershell\WMI ??

    Thanks

    Shahid

    Shahid.a.shah@gmail.com(Primary Email)

    v-2shahs@hotmail.com(secondary Email)

    Thursday, September 27, 2012 2:32 PM