Scripts triggered by thresholds not in the "Recent Processes" report

mjones
mjones Member Posts: 184 ✭✭✭✭

I recently realized that when a script is run by a threshold, it doesn't seem to be documented anywhere that I can find. I am looking in the "Audit Log and in the "Recent Processes" report.

We need to be able to see when scripts are being run, regardless of how they are started.

Is this just me, am I looking in the wrong place?

Comments

  • mbudke
    mbudke Member Posts: 131 ✭✭✭

    Hi @MJones ,

    I can confirm the behavior but I am not sure if I would like to change it. I am having a few threshold configurations which run scripts to either check or change values. This would spam my report.

    PowerShell allows to write Eventlogs so for required scripts you can write an eventlog and monitor for these. :-)

  • Sarah_from_Atera
    Sarah_from_Atera Member Posts: 93 ✭✭✭
    edited December 2023

    Hi @MJones, Sarah from Atera here.

    At the moment, there is no documentation for scripts run by a threshold in reporting. Our RMM team has looked into this, and it is possible it will be developed in the future. However, it is not the plan for now.

    In the meantime, you can see the results of a script in the alert itself.

  • mjones
    mjones Member Posts: 184 ✭✭✭✭

    Hey Sarah,

    The alert doesn't show that it ran a script as a result of the alert being triggered at all though in the alert, ticket, or Recent Processes report.

    I have a script-based threshold that fires an alert if we have backed up print jobs.

    The threshold runs a script "Stuck Print Remediation" if it sees more than 5 pending jobs for 3 minutes.
    I need to know that the "Stuck Print Remediation" script ran and what the output\result was. This seems like a pretty basic logging functionality that should be there.

  • mjones
    mjones Member Posts: 184 ✭✭✭✭

    I can look into that event logging, it just seems like it should be logging that it did something somewhere.

  • mjones
    mjones Member Posts: 184 ✭✭✭✭
    edited March 11

    I have resorted to just emailing a log of the script output so that I can know it ran and what it did exactly.

    In my opinion, this is still a huge missing feature, we need to be able to track what happens to scripts regardless of where they are run from.

    For example:

    $txt_File_Output_Path = "Atera_"+$Env:windir+"\temp"+$Env:ComputerName+"Script"+$currDate+".txt"
    Start-Transcript -Path $txt_File_Output_Path #Script does a thing #Some-Function Write-Host "Some output." Stop-Transcript $smtpServer = "mail.smtp2go.com" $from = "script@yourdomain.com" $to = "you@yourdomain.com" $subject = "Script Output" $body = "See attached files for script output." $port = 2525 $encrypted = [Text.Encoding]::Utf8.GetString([Convert]::FromBase64String([Text.Encoding]::Utf8.GetString([Convert]::FromBase64String('Double_Base64_String_Goes_Here')))) $smtpPassword = ConvertTo-SecureString -String $encrypted -AsPlainText -Force $smtpCredential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $from, $smtpPassword $attachments = @($txt_File_Output_Path) Send-MailMessage -SmtpServer $smtpServer -From $from -To $to -Subject $subject -Body $body -Attachments $attachments -UseSsl -Port $port -Credential $smtpCredential -Encoding "utf8"