โ12-07-2022 08:48 AM
I have a scheculed command that runs every hour against sixty servers, as you can imagine this has resulted in filling up the results tab and made it hard to see "the wood for the trees", is there a way for a particualr command to only log results if its bad news? or even just filter them out?
โ12-07-2022 10:58 AM
Hey @ncarmichael, this is a common ask, there is a command to get this information.
You can run:
$results = Get-JCCommandResult -CommandId 638fa01dbaa9c1add7cc6566
Where CommandID is the ID of the command that you have set to run hourly.
In the example below I dump the contents of the command into the $results variable. From there you can look at all the elements of each command result and save to CSV or similar.
โ
โ12-07-2022 11:48 AM
Hi @jworkman
It not that I want to see those messages, its that I don't! We are in a wierd profession where good-news is a distration from the bad-news we're paid to fix ๐
Is it possible to filter or remove them using the frontend, I would rather not being daisy-chaining filter in powershell!
Perhap a checkbox (for each individual comman) that says "if the exit code is zero, don't log it"
I have tried seaching for the name of the command in the results window so I may delete them, but as there are 12,000 of them, it crashes my browser.
Neil
โ12-08-2022 02:27 PM
Not in the browser, but you can use that same command to filter by instances where the command failed:
$results = Get-JCCommandResult -CommandId 638fa01dbaa9c1add7cc6566
$results | Where-Object { $_.exitCode -ne 0 } | Select-Object system, exitCode, responseTime
This would return the results for the command you specified and then filter by results to only return instances where the exitCode was not 0.
โ12-21-2022 06:32 AM
Unfortunatly that came back with
Get-JCCommandResult : A parameter cannot be found that matches parameter name 'CommandId'
I tried with
$JCAPIKEY='topsecretapikey'
$results = Get-JCCommandResult -ById 63088a195daae9163db2a1ad
but got
Invoke-RestMethod : {"message":"Not Found"}
So I have looked at the API and looks like I may be able to list them that way, how can I then delete then ones I am not interested in
โ12-28-2022 03:43 PM
Hey you'll get that message if you are not using the latest version of the PowerShell Module. CommandID is not a parameter for previous versions of the module.
You should be able to just run `Update-JCModule` to update to the latest version of PowerShell module but we did add that change in version 2.0.1
New to the site? Take a look at these additional resources:
Ready to join us? You can register here.