cancel
Showing results for 
Search instead for 
Did you mean: 
Create Post
Level 8

ARM Alerts Script Parameters

Hello,

I'm trying something on Fileserver Alert :

I would like to recuperate in a script, the Event-Author -> Login-Name. I can see it in the logfile when i force an error on the script but i recuperate it in my script by parameters if there is no error.

I use : $userName = $args[0]

Do you have any ideas ?

pastedImage_0.png

Kind Regards

0 Kudos
2 Replies
Level 10

Hi florian,

you can use the jsonImport.ps1 as base and the use "JSON object and additional argument" as base.

pastedImage_0.png

There you got the whole object and then you can iterate over it.

$events = (Get-Content  $json -Raw) -join "`n" | ConvertFrom-Json

    foreach($event in $events.EventData.DirectoryChangeActionEventData)

    {

         $name = $event.EventAuthor.LoginName

         Write-Host $name

    }

if you need more information contact me mike.wiedemann@cusatum.de . We are doing consulting for ARM and that is our daily business.

Cheers

Mike

Hi,

I prefer to use powershell but your answer gave me a clue about the mistake I had. By default, ARM proposes the following arguments:

{EventAuthor-> LoginName} that must be changed to: {EventData-> DirectoryChangeActionEventData0-> EventAuthor-> LoginName} in the ARM configurator.

Thank you for your answer !

Florian P