We recently deployed a script that runs daily on around 120 endpoints.
Is there anyway to find out if the script has ran, was successful or failed? Like a report or something similar.
The only way I found was to select each asset and see the result, but surely there has to be a better way to find out more about the scheduled script after the time has passed.
Careful though, with that number of assets, there is a possibility you might trigger API Limits and get throttled. This isn’t too bad though, you just may want to add something to help stagger the execution time with something like this
$seconds = Get-Random -Minimum 1 -Maximum 120
Write-Host "Pausing for $seconds to stagger execution time"
Start-Sleep -Seconds $seconds
#Your Script Continues here
A better solution might be to just monitor for failures within your script, and if it doesn’t do what you expect then have it throw an RMM alert. That way you aren’t wasting any time with successes, and you are exclusively triaging failures. You also won’t run into throttling issues with the API when mass running scripts. From the Automated Remediation module, you could optionally pick those up and depending on severity take additional action outside of just opening the alert, like creating a ticket or sending email notifications.
Yep, it’s not something supported today in the way you are expecting. Quite possible we see this next year. It’s something I’d like to have added.
Down at the bottom of the New/Edit Script page you should have a “Powershell Quick Help”
You should have an example for Set-Asset-Field (and other commands) in that.
For Set-Asset-Field - I copied it below
# This can write to your Asset Custom Fields. Use it to store adhoc information that isn't currently surfaced.
Set-Asset-Field -Name "CustomFieldName" -Value "New Custom Field Value"
The module itself is at $env:programdata\Syncro\bin\module.psm1 but it is not something that you can just import-module and be off running with locally easily.
You can, open the Module in VS Code or similar and browse through the module to get an idea of how the PowerShell is working and what APIs it is using to make a call.
Do Be aware, though, that a good number of these methods are internal, and you cannot easily debug them or access them (For example Call-SyncroAPI or Invoke-WebRequest20)
You can get a very limited view of the commands by doing Get-Help though
CD $env:ProgramData\Syncro\bin\
Import-Module Module.psm1 -verbose
Get-Command -Module module
Get-Help Send-Email
Another option for reporting is to do log entries: Log-Activity -Message "Activity description" -EventName "Event name"
Then you can query them using the Asset Activity Audit report.