cancel
Showing results for 
Search instead for 
Did you mean: 

How can I not see command results I am not interested in?

ncarmichael
Rising Star II

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?

5 REPLIES 5

jworkman
JumpCloud Employee
JumpCloud Employee

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.

Screen Shot 2022-12-07 at 8.55.49 AM.png

ncarmichael
Rising Star II

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

jworkman
JumpCloud Employee
JumpCloud Employee

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.

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

 

 

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