< Back

Get-JCCommandResult

Thu Jan 16, 2020 8:50 am

NAME Get-JCCommandResult



SYNOPSIS

Returns all JumpCloud Command Results within a JumpCloud tenant or a single JumpCloud Command Result using the

-ByID Parameter.





SYNTAX

Get-JCCommandResult [-CommandResultID] <System.String> [-ByID] [<CommonParameters>]



Get-JCCommandResult [-Limit <System.Int32>] [-Skip <System.Int32>] [<CommonParameters>]



Get-JCCommandResult [-Limit <System.Int32>] [-MaxResults <System.Int32>] [-Skip <System.Int32>]

[<CommonParameters>]



Get-JCCommandResult [-TotalCount] [<CommonParameters>]





DESCRIPTION

The Get-JCCommandResult function returns all command results within a JumpCloud tenant. To return the command

results output the -ByID Parameter must be used as this information is only accessible when using this Parameter.





PARAMETERS

-ByID <System.Management.Automation.SwitchParameter>

Use the -ByID parameter when you want to query the contents of a specific Command Result or if the

-CommandResultID is being passed over the pipeline to return the full contents of a JumpCloud Command Result.

The -ByID SwitchParameter will set the ParameterSet to 'ByID' which queries one JumpCloud Command Result at a

time.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-CommandResultID <System.String>

The _id of the JumpCloud Command Result you wish to query.



Required? true

Position? 0

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Limit <System.Int32>

How many command results to return in each API call.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-MaxResults <System.Int32>

The maximum number of results to return.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Skip <System.Int32>

The number of command results to skip over before returning results.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-TotalCount <System.Management.Automation.SwitchParameter>

A switch parameter to only return the number of command results.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

System.String







OUTPUTS

System.Object







NOTES









-------------------------- Example 1 --------------------------



PS C:\\> Get-JCCommandResult



Returns all JumpCloud Commands Results

-------------------------- Example 2 --------------------------



PS C:\\> Get-JCCommandResult -CommandResultID 5m0o65m6i4sb973059omb762



Returns a single JumpCloud Command Result with CommandResultID '5j09o6f23dan6f4n035601d5'. Note that the command

results output will be present in the output from this command.

-------------------------- Example 3 --------------------------



PS C:\\> Get-JCCommandResult | Where-Object {$_.requestTime -GT (Get-Date).AddDays(-7) -and $_.exitCode -ne 0}



Returns all JumpCloud Command Result that were run within the last seven days and that did not return an exitCode

of '0'. Note an exitCode of zero generally represents a successful run of a command. This command returns all

failed commands results for the past seven days.

-------------------------- Example 4 --------------------------



PS C:\\> Get-JCCommandResult | Where-Object requestTime -GT (Get-Date).AddHours(-1) | Get-JCCommandResult -ByID |

Select-Object -ExpandProperty output



Returns the output for all JumpCloud Command results that were run within the last hour using the -ByID Parameter

and Parameter Binding.



Note that when running this command the time for the output to display will be directly proportionate to how many

JumpCloud commands that match the criteria. The command 'Get-JCCommandResult -ByID' runs once for every JumpCloud

command result that matches the criteria Where-Object criteria.

-------------------------- Example 5 --------------------------



PS C:\\> Get-JCCommandResult -TotalCount



Returns the total number of JumpCloud command results

-------------------------- Example 6 --------------------------



PS C:\\> Get-JCCommandResult -Skip 100



Skips returning the first 100 command results and only returns the results after 100. Command results are sorted

by execution time.

-------------------------- Example 6 --------------------------



PS C:\\> Get-JCCommandResult -Skip 100 -MaxResults 10



Skips returning the first 100 command results and only returns the 10 results after the first 100 results.

Command results are sorted by execution time.



RELATED LINKS

Online Version: https://github.com/TheJumpCloud/support ... mandResult