Get JCCommandResult - TheJumpCloud/support GitHub Wiki
Returns all JumpCloud Command Results within a JumpCloud tenant or a single JumpCloud Command Result using the -ByID Parameter.
Get-JCCommandResult [<CommonParameters>]
Get-JCCommandResult [-CommandResultID] <String> [<CommonParameters>]
Get-JCCommandResult [-CommandID <String>] [-ByCommandID]
[<CommonParameters>]
Get-JCCommandResult [-Detailed] [<CommonParameters>]
Get-JCCommandResult [-TotalCount] [<CommonParameters>]
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.
PS C:\> Get-JCCommandResult
Returns all JumpCloud Commands Results
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.
PS C:\> Get-JCCommandResult -CommandID 6307e611baab9f408ff17eb9
Returns all JumpCloud Command Result corresponding to the JumpCloud Command with ID: '6307e611baab9f408ff17eb9'. Note that the command results output will be present in the output from this command.
PS C:\> Get-JCComand -Name "GetJCAgentLog" | Get-JCCommandResult -ByCommandID
Returns all JumpCloud Commands with the name "GetJCAgentLog", and pipes the output to Get-JCComandResult. The "-ByCommandID" switch will flag the command to get the results for each commandID passed in. Multiple commands can be piped into the function.
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.
PS C:\> Get-JCCommandResult -Detailed | Where-Object requestTime -GT (Get-Date).AddHours(-1) | 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 -Detailed' runs once for every JumpCloud command result that matches the criteria Where-Object criteria.
PS C:\> Get-JCCommandResult -TotalCount
Returns the total number of JumpCloud command results
Use the -ByCommandID or -ByWorkflowID parameter when you want to query the results of a specific Command. The -ByCommandID or -ByWorkflowID SwitchParameter will set the ParameterSet to 'ByCommandID' which queries all JumpCloud Command Results for that particular Command.
Type: System.Management.Automation.SwitchParameter
Parameter Sets: ByCommandID
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
The _id of the JumpCloud Command you wish to query.
Type: System.String
Parameter Sets: ByCommandID
Aliases: WorkflowID
Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False
The _id of the JumpCloud Command Result you wish to query.
Type: System.String
Parameter Sets: ByID
Aliases: _id, id
Required: True
Position: 0
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False
A switch parameter to return the detailed output of each command result
Type: System.Management.Automation.SwitchParameter
Parameter Sets: Detailed
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
A switch parameter to only return the number of command results.
Type: System.Management.Automation.SwitchParameter
Parameter Sets: TotalCount
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.