IdentityManager.PoSh

Hi 

I don't see any open topic for IdentityManager.PoSh hence I open this one.

Can you please show some example how to run a custom event which is having a custom variable in the jobchain's generating condition.

Basically I have a problem in running ADSAccount UPDATE event with custom variable...

Parents Reply Children
  • Let's assume you want to specify parameters for the parameter collection (as mentioned above).

    Then you can use the cmdlet parameter EventParameters to specify a hashtable with your additional parameters. (https://github.com/OneIdentity/IdentityManager.PoSh)

    Trigger an event for an entity

    After you know the name for the event to trigger, you can fire it like:

    Invoke-ImEvent -Entity $p1 -EventName "CHECK_EXITDATE"
    

    It's possible to pass certain event parameters if needed. Use EventParameters as hash table for that.

    A sample code would look like the following:

    # Specify the parameters in a hash  table
    $myParameters = @{myparametername1 = "myvalue1"; myparametername2 = "myvalue2"}
    
    # Trigger an event for an entity with your additional parameters
    Invoke-IMEvent -Entity $myentity -EventName "Name of the event" -EventParameters $myParameters

  • okay, I think I have misunderstood the concept of Invoke-ImEvent cmdlet. 

    I was trying to run ADSAccount update event with some value i.e Surname while having a gen condition FULLSYNC = FALSE and CUSTOMVARIABLE = TRUE. 

    So now, instead of running Invoke-ImEvent I've ran SET cmdlet with session variables.

    Sample code:

    # Get the session
    $sessionToUse = $Global:imsessions[$Global:imsessions.Keys[0]].Session

    # Add variable

    $sessionToUse.Variables.Put('FULLSYNC', $false)
    $sessionToUse.Variables.Put('CUSTOMVARIABLE', $true)

    # Query a variable
    $sessionToUse.Variables['FULLSYNC']
    $sessionToUse.Variables['CUSTOMVARIABLE']

    # Run Command
    Set-Entity -Type ADSAccount -Identity "6h27ef73-a13f-40eb-a7a3-2f49e487e5g2" -Properties @{'Surname' = 'Schmidt'}

    # Remove a variable
    $sessionToUse.Variables.Remove('FULLSYNC')
    $sessionToUse.Variables.Remove('CUSTOMVARIABLE')

    # Query a variable
    $sessionToUse.Variables['FULLSYNC']
    $sessionToUse.Variables['CUSTOMVARIABLE']

    Regarding $PC(ParameterName)$ can I run

    Invoke-ImEvent  -EventName "EVENT" -Identity "UID" -Type "TABLE" -EventParameters @{"paramName":"paramValue"} ?

  • Okay, my bad. If you said variable I somehow replaced this with parameter in my head. But you found the session variables which would be honored during the event generation as well.

    Yes, you can use the parameters -Identity and -Type for Invole-ImEvent as well.

    But I think your hash-table is wrong. It needs to be @{paramName = "paramValue"}

  • I will note it down, Thanks Markus!