From 6f6c7b6d365f624ee0a16830c95160103ac213b3 Mon Sep 17 00:00:00 2001 From: Ken Maranion Date: Fri, 17 Jun 2022 09:29:41 -0700 Subject: [PATCH 01/13] Added search functionality --- .../Public/Commands/Get-JCCommand.ps1 | 185 ++++++++++++++++-- 1 file changed, 165 insertions(+), 20 deletions(-) diff --git a/PowerShell/JumpCloud Module/Public/Commands/Get-JCCommand.ps1 b/PowerShell/JumpCloud Module/Public/Commands/Get-JCCommand.ps1 index 6d65b6003..578eeffac 100644 --- a/PowerShell/JumpCloud Module/Public/Commands/Get-JCCommand.ps1 +++ b/PowerShell/JumpCloud Module/Public/Commands/Get-JCCommand.ps1 @@ -1,10 +1,43 @@ Function Get-JCCommand () { - [CmdletBinding(DefaultParameterSetName = 'ReturnAll')] + [CmdletBinding(DefaultParameterSetName = 'SearchFilter')] param ( + + #### NEW PARAMS + [Parameter( ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', Position = 0, HelpMessage = 'The command to execute on the server.')] + [String]$command, + [Parameter( ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', Position = 0, HelpMessage = 'Name of the command')] + [String]$name, + [Parameter( ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', Position = 0, HelpMessage = 'System Id')] + [String]$systemId, + [Parameter( ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', Position = 0, HelpMessage = 'Command User')] + [String]$user, + [Parameter( ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', Position = 0, HelpMessage = 'Sudo User')] + [bool]$sudo, + [Parameter( ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', Position = 0, HelpMessage = 'Workflow Id')] + [string]$workflowId, + [Parameter( ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', Position = 0, HelpMessage = 'System Name')] + [string]$system, + [Parameter( ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', Position = 0, HelpMessage = 'Command Type')] + [string]$commandType, + [Parameter( ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', Position = 0, HelpMessage = 'Exit Code')] + [int]$exitCode, + [Parameter( ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', Position = 0, HelpMessage = 'Launch Type')] + [string]$launchType, + [Parameter( ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', Position = 0, HelpMessage = 'Listens To')] + [string]$listensTo, + [Parameter( ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', Position = 0, HelpMessage = 'Schedule')] + [string]$schedule, + [Parameter( ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', Position = 0, HelpMessage = 'The name of the command trigger')] + [string]$trigger, + [Parameter( ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', Position = 0, HelpMessage = 'When the command will repeat')] + [string]$scheduleRepeatType, + [Parameter( ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', Position = 0, HelpMessage = 'The ID of the organization')] + [string]$organization, + #### NEW PARAMS END [Parameter(Mandatory, ValueFromPipelineByPropertyName, ParameterSetName = 'ByID', @@ -21,8 +54,6 @@ CommandID has an Alias of _id. This means you can leverage the PowerShell pipeli [Switch] $ByID ) - - begin { @@ -42,17 +73,23 @@ CommandID has an Alias of _id. This means you can leverage the PowerShell pipeli { $hdrs.Add('x-org-id', "$($JCOrgID)") } + Write-Verbose 'Initilizing resultsArray' - [int]$limit = '100' - Write-Debug "Setting limit to $limit" + $resultsArrayList = New-Object -TypeName System.Collections.ArrayList - Write-Debug 'Initilizing resultsArray and resultsArrayByID' - $resultsArray = @() + Write-Verbose "Parameter Set: $($PSCmdlet.ParameterSetName)" } process { + [int]$limit = '100' + Write-Verbose "Setting limit to $limit" + + [int]$skip = '0' + Write-Verbose "Setting limit to $limit" + + [int]$Counter = 0 if ($PSCmdlet.ParameterSetName -eq 'ReturnAll') @@ -61,7 +98,7 @@ CommandID has an Alias of _id. This means you can leverage the PowerShell pipeli Write-Debug 'Setting skip to zero' [int]$skip = 0 #Do not change! - while (($resultsArray).Count -ge $skip) + while (($resultsArrayList).Count -ge $skip) { $limitURL = "$JCUrlBasePath/api/commands?sort=type,_id&limit=$limit&skip=$skip" Write-Debug $limitURL @@ -70,31 +107,139 @@ CommandID has an Alias of _id. This means you can leverage the PowerShell pipeli $skip += $limit Write-Debug "Setting skip to $skip" - - $resultsArray += $results.results - $count = ($resultsArray).Count + $resultsArrayList += $results.results + $count = ($resultsArrayList).Count Write-Debug "Results count equals $count" } } - elseif ($PSCmdlet.ParameterSetName -eq 'ByID') - + + switch ($PSCmdlet.ParameterSetName) { - foreach ($uid in $CommandID) + SearchFilter + { + + while ((($resultsArrayList.Results).Count) -ge $Counter) + { + + if ($returnProperties) + { + + $Search = @{ + filter = @( + @{ + } + ) + limit = $limit + skip = $skip + fields = $returnProperties + } #Initialize search + + } + + else + { + + $Search = @{ + filter = @( + @{ + + } + ) + limit = $limit + skip = $skip + + } #Initialize search + + } + + foreach ($param in $PSBoundParameters.GetEnumerator()) + { + if ([System.Management.Automation.PSCmdlet]::CommonParameters -contains $param.key) { continue } + if ($param.value -is [Boolean]) + { + (($Search.filter).GetEnumerator()).add($param.Key, $param.value) + + continue + } + if ($param.key -eq 'returnProperties') + { + continue + } + + $Value = ($param.value).replace('*', '') + + if (($param.Value -match '.+?\*$') -and ($param.Value -match '^\*.+?')) + { + # Front and back wildcard + (($Search.filter).GetEnumerator()).add($param.Key, @{'$regex' = "$Value" }) + } + elseif ($param.Value -match '.+?\*$') + { + # Back wildcard + (($Search.filter).GetEnumerator()).add($param.Key, @{'$regex' = "^$Value" }) + } + elseif ($param.Value -match '^\*.+?') + { + # Front wild card + (($Search.filter).GetEnumerator()).add($param.Key, @{'$regex' = "$Value`$" }) + } + else + { + (($Search.filter).GetEnumerator()).add($param.Key, $Value) + } + + } # End foreach + + + $SearchJSON = $Search | ConvertTo-Json -Compress -Depth 4 + + Write-Debug $SearchJSON + + $URL = "$JCUrlBasePath/api/search/commands" + + $Results = Invoke-RestMethod -Method POST -Uri $Url -Header $hdrs -Body $SearchJSON -UserAgent:(Get-JCUserAgent) + + $null = $resultsArrayList.Add($Results) + + $Skip += $limit + + $Counter += $limit + } #End While + + } # End Search + ByID + { + foreach ($uid in $CommandID) { $URL = "$JCUrlBasePath/api/commands/$uid" Write-Debug $URL $CommandResults = Invoke-RestMethod -Method GET -Uri $URL -Headers $hdrs -UserAgent:(Get-JCUserAgent) - $resultsArray += $CommandResults + $null = $resultsArrayList.add($CommandResults) + + } + } +}# End Switch + } + end + { + switch ($PSCmdlet.ParameterSetName) + { + SearchFilter + { + return $resultsArrayList.Results | Select-Object -Property * } + ByID + { + return $resultsArrayList | Select-Object -Property * + } + } } - end +} - { - return $resultsArray - } -} \ No newline at end of file + + From 5d0e17f0fe3ef5afe1fcf1c33df72e9ee5298d9a Mon Sep 17 00:00:00 2001 From: Geoffrey Wein Date: Mon, 20 Jun 2022 16:59:09 -0500 Subject: [PATCH 02/13] command search tests --- .../Public/Commands/Get-JCCommand.tests.ps1 | 45 ++++++++++++++++++- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/PowerShell/JumpCloud Module/Tests/Public/Commands/Get-JCCommand.tests.ps1 b/PowerShell/JumpCloud Module/Tests/Public/Commands/Get-JCCommand.tests.ps1 index c6b8d3451..dd80aaa39 100755 --- a/PowerShell/JumpCloud Module/Tests/Public/Commands/Get-JCCommand.tests.ps1 +++ b/PowerShell/JumpCloud Module/Tests/Public/Commands/Get-JCCommand.tests.ps1 @@ -39,6 +39,47 @@ Describe -Tag:('JCCommand') 'Get-JCCommand 1.0' { $Triggers = Get-JCCommand | Where-Object trigger -ne '' $Triggers._id.Count | Should -BeGreaterThan 1 } - - } + +Describe -Tag('JCCommand') 'Get-JCCommand Search' { + BeforeAll { + Connect-JCOnline -JumpCloudApiKey:($PesterParams_ApiKey) -force | Out-Null + $PesterParams_Command1 = Get-JCCommand -CommandID:($PesterParams_Command1.Id) + } + It "Searches a JumpCloud command by name" { + $Command = Get-JCCommand -name $PesterParams_Command1.name + $Command.name | Should -Be $PesterParams_Command1.name + } + It "Searches a JumpCloud command by command" { + $Command = Get-JCCommand -command $PesterParams_Command1.command + $Command.command | Should -Be $PesterParams_Command1.command + } + It "Searches a JumpCloud command by commandType" { + $Command = Get-JCCommand -commandType $PesterParams_Command1.commandType + $Command.commandType | Should -Be $PesterParams_Command1.commandType + } + It "Searches a JumpCloud command by launchType" { + $Command = Get-JCCommand -launchType $PesterParams_Command1.launchType + $Command.launchType | Should -Be $PesterParams_Command1.launchType + } + It "Searches a JumpCloud command by listensTo" { + $Command = Get-JCCommand -listensTo $PesterParams_Command1.listensTo + $Command.listensTo | Should -Be $PesterParams_Command1.listensTo + } + It "Searches a JumpCloud command by schedule" { + $Command = Get-JCCommand -schedule $PesterParams_Command1.schedule + $Command.schedule | Should -Be $PesterParams_Command1.schedule + } + It "Searches a JumpCloud command by trigger" { + $Command = Get-JCCommand -trigger $PesterParams_Command1.trigger + $Command.trigger | Should -Be $PesterParams_Command1.trigger + } + It "Searches a JumpCloud command by scheduleRepeatType" { + $Command = Get-JCCommand -scheduleRepeatType $PesterParams_Command1.scheduleRepeatType + $Command.scheduleRepeatType | Should -Be $PesterParams_Command1.scheduleRepeatType + } + It "Searches a JumpCloud command by organization" { + $Command = Get-JCCommand -organization $PesterParams_Command1.organization + $Command.organization | Should -Be $PesterParams_Command1.organization + } +} \ No newline at end of file From fd8aab3da471729923bc8865821c00ad4271736d Mon Sep 17 00:00:00 2001 From: Ken Maranion Date: Tue, 21 Jun 2022 09:23:19 -0700 Subject: [PATCH 03/13] cleaned up parameters --- .../Public/Commands/Get-JCCommand.ps1 | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/PowerShell/JumpCloud Module/Public/Commands/Get-JCCommand.ps1 b/PowerShell/JumpCloud Module/Public/Commands/Get-JCCommand.ps1 index 578eeffac..48214695e 100644 --- a/PowerShell/JumpCloud Module/Public/Commands/Get-JCCommand.ps1 +++ b/PowerShell/JumpCloud Module/Public/Commands/Get-JCCommand.ps1 @@ -11,20 +11,8 @@ Function Get-JCCommand () [String]$command, [Parameter( ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', Position = 0, HelpMessage = 'Name of the command')] [String]$name, - [Parameter( ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', Position = 0, HelpMessage = 'System Id')] - [String]$systemId, - [Parameter( ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', Position = 0, HelpMessage = 'Command User')] - [String]$user, - [Parameter( ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', Position = 0, HelpMessage = 'Sudo User')] - [bool]$sudo, - [Parameter( ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', Position = 0, HelpMessage = 'Workflow Id')] - [string]$workflowId, - [Parameter( ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', Position = 0, HelpMessage = 'System Name')] - [string]$system, [Parameter( ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', Position = 0, HelpMessage = 'Command Type')] [string]$commandType, - [Parameter( ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', Position = 0, HelpMessage = 'Exit Code')] - [int]$exitCode, [Parameter( ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', Position = 0, HelpMessage = 'Launch Type')] [string]$launchType, [Parameter( ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', Position = 0, HelpMessage = 'Listens To')] From 464ccb7f9ab0c1cede6663cbff658f627f22e544 Mon Sep 17 00:00:00 2001 From: Ken Maranion Date: Tue, 21 Jun 2022 12:21:53 -0700 Subject: [PATCH 04/13] changelog --- .circleci/workflows.yml | 2 +- PowerShell/JumpCloud Module/JumpCloud.psd1 | 2 +- .../Public/Commands/Get-JCCommand.ps1 | 3 +++ PowerShell/ModuleBanner.md | 6 +++--- PowerShell/ModuleChangelog.md | 11 +++++++++++ 5 files changed, 19 insertions(+), 5 deletions(-) diff --git a/.circleci/workflows.yml b/.circleci/workflows.yml index 8f97ecc25..8e4572fba 100755 --- a/.circleci/workflows.yml +++ b/.circleci/workflows.yml @@ -32,7 +32,7 @@ parameters: description: 'Release Type. Accepted values [ Major, Minor, Patch ]' type: enum enum: ["Major", "Minor", "Patch"] - default: "Patch" + default: "Minor" RequiredModulesRepo: description: 'PowerShell Repository for JumpCloud SDKs' type: enum diff --git a/PowerShell/JumpCloud Module/JumpCloud.psd1 b/PowerShell/JumpCloud Module/JumpCloud.psd1 index 043c770a1..b3419ad7c 100755 --- a/PowerShell/JumpCloud Module/JumpCloud.psd1 +++ b/PowerShell/JumpCloud Module/JumpCloud.psd1 @@ -12,7 +12,7 @@ RootModule = 'JumpCloud.psm1' # Version number of this module. -ModuleVersion = '1.22.1' +ModuleVersion = '1.23.0' # Supported PSEditions # CompatiblePSEditions = @() diff --git a/PowerShell/JumpCloud Module/Public/Commands/Get-JCCommand.ps1 b/PowerShell/JumpCloud Module/Public/Commands/Get-JCCommand.ps1 index 48214695e..4f0e9dc23 100644 --- a/PowerShell/JumpCloud Module/Public/Commands/Get-JCCommand.ps1 +++ b/PowerShell/JumpCloud Module/Public/Commands/Get-JCCommand.ps1 @@ -25,6 +25,9 @@ Function Get-JCCommand () [string]$scheduleRepeatType, [Parameter( ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', Position = 0, HelpMessage = 'The ID of the organization')] [string]$organization, + [Parameter(ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', HelpMessage = 'Allows you to return select properties on JumpCloud user objects. Specifying what properties are returned can drastically increase the speed of the API call with a large data set. Valid properties that can be returned are: ''command'', ''name'',''commandType'', ''launchType'',''listensTo'',''schedule'',''trigger'',''scheduleRepeatType'',''organization''')] + [ValidateSet('command', 'name', 'commandType', 'launchType', 'listensTo', 'schedule', 'trigger', 'scheduleRepeatType', 'organization')] + [String[]]$returnProperties, #### NEW PARAMS END [Parameter(Mandatory, ValueFromPipelineByPropertyName, diff --git a/PowerShell/ModuleBanner.md b/PowerShell/ModuleBanner.md index bb254955d..57feda7b0 100755 --- a/PowerShell/ModuleBanner.md +++ b/PowerShell/ModuleBanner.md @@ -1,17 +1,17 @@ #### Latest Version ``` -1.22.1 +1.23.0 ``` #### Banner Current ``` -* Added functionality for Set, Get, New-JCUser to Search by Email to Manager Field +* Added search endpoint functionality and parameters to Get-jCCommand ``` #### Banner Old ``` -* New parameter -recoveryemail for Set, Get, New-JCUser +* Added functionality for Set, Get, New-JCUser to Search by Email to Manager Field ``` diff --git a/PowerShell/ModuleChangelog.md b/PowerShell/ModuleChangelog.md index b348b052d..fd2750d88 100644 --- a/PowerShell/ModuleChangelog.md +++ b/PowerShell/ModuleChangelog.md @@ -1,3 +1,14 @@ +## 1.23.0 + +Release Date: June 21, 2022 + +#### RELEASE NOTES + +This release adds search endpoint functionality and new parameters to Get-JCCommand + +#### BUG FIXES: + +* N/A ## 1.22.1 Release Date: May 19, 2022 From a6234e890f1b0a5d0b6845495ca87a982daf211e Mon Sep 17 00:00:00 2001 From: TheJumpCloud Date: Tue, 21 Jun 2022 19:29:55 +0000 Subject: [PATCH 05/13] Updating PowerShell Module;[skip ci] --- .../JumpCloud Module/Docs/Get-JCCommand.md | 159 ++++++++++- PowerShell/JumpCloud Module/Docs/JumpCloud.md | 2 +- PowerShell/JumpCloud Module/JumpCloud.psd1 | 2 +- .../JumpCloud Module/en-Us/JumpCloud-help.xml | 262 ++++++++++++++++++ 4 files changed, 421 insertions(+), 4 deletions(-) diff --git a/PowerShell/JumpCloud Module/Docs/Get-JCCommand.md b/PowerShell/JumpCloud Module/Docs/Get-JCCommand.md index 0cd9d12ab..8c9fc1af0 100644 --- a/PowerShell/JumpCloud Module/Docs/Get-JCCommand.md +++ b/PowerShell/JumpCloud Module/Docs/Get-JCCommand.md @@ -12,9 +12,11 @@ Returns all JumpCloud Commands within a JumpCloud tenant or a single JumpCloud C ## SYNTAX -### ReturnAll (Default) +### SearchFilter (Default) ``` -Get-JCCommand [] +Get-JCCommand [[-command] ] [[-name] ] [[-commandType] ] [[-launchType] ] + [[-listensTo] ] [[-schedule] ] [[-trigger] ] [[-scheduleRepeatType] ] + [[-organization] ] [-returnProperties ] [] ``` ### ByID @@ -77,6 +79,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -command +The command to execute on the server. + +```yaml +Type: System.String +Parameter Sets: SearchFilter +Aliases: + +Required: False +Position: 0 +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + ### -CommandID The _id of the JumpCloud command you wish to query. @@ -102,11 +119,149 @@ Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` +### -commandType +Command Type + +```yaml +Type: System.String +Parameter Sets: SearchFilter +Aliases: + +Required: False +Position: 0 +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -launchType +Launch Type + +```yaml +Type: System.String +Parameter Sets: SearchFilter +Aliases: + +Required: False +Position: 0 +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -listensTo +Listens To + +```yaml +Type: System.String +Parameter Sets: SearchFilter +Aliases: + +Required: False +Position: 0 +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -name +Name of the command + +```yaml +Type: System.String +Parameter Sets: SearchFilter +Aliases: + +Required: False +Position: 0 +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -organization +The ID of the organization + +```yaml +Type: System.String +Parameter Sets: SearchFilter +Aliases: + +Required: False +Position: 0 +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -returnProperties +Allows you to return select properties on JumpCloud user objects. Specifying what properties are returned can drastically increase the speed of the API call with a large data set. Valid properties that can be returned are: 'command', 'name','commandType', 'launchType','listensTo','schedule','trigger','scheduleRepeatType','organization' + +```yaml +Type: System.String[] +Parameter Sets: SearchFilter +Aliases: +Accepted values: command, name, commandType, launchType, listensTo, schedule, trigger, scheduleRepeatType, organization + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -schedule +Schedule + +```yaml +Type: System.String +Parameter Sets: SearchFilter +Aliases: + +Required: False +Position: 0 +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -scheduleRepeatType +When the command will repeat + +```yaml +Type: System.String +Parameter Sets: SearchFilter +Aliases: + +Required: False +Position: 0 +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -trigger +The name of the command trigger + +```yaml +Type: System.String +Parameter Sets: SearchFilter +Aliases: + +Required: False +Position: 0 +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + ### CommonParameters This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS +### System.String + ### System.String[] ## OUTPUTS diff --git a/PowerShell/JumpCloud Module/Docs/JumpCloud.md b/PowerShell/JumpCloud Module/Docs/JumpCloud.md index e7fb530d6..0d95a1d73 100644 --- a/PowerShell/JumpCloud Module/Docs/JumpCloud.md +++ b/PowerShell/JumpCloud Module/Docs/JumpCloud.md @@ -2,7 +2,7 @@ Module Name: JumpCloud Module Guid: 31c023d1-a901-48c4-90a3-082f91b31646 Download Help Link: https://github.com/TheJumpCloud/support/wiki -Help Version: 1.22.1 +Help Version: 1.23.0 Locale: en-US --- diff --git a/PowerShell/JumpCloud Module/JumpCloud.psd1 b/PowerShell/JumpCloud Module/JumpCloud.psd1 index b3419ad7c..8aa62ced7 100755 --- a/PowerShell/JumpCloud Module/JumpCloud.psd1 +++ b/PowerShell/JumpCloud Module/JumpCloud.psd1 @@ -3,7 +3,7 @@ # # Generated by: JumpCloud Solutions Architect Team # -# Generated on: 5/19/2022 +# Generated on: 6/21/2022 # @{ diff --git a/PowerShell/JumpCloud Module/en-Us/JumpCloud-help.xml b/PowerShell/JumpCloud Module/en-Us/JumpCloud-help.xml index ad3cb65cb..015101147 100644 --- a/PowerShell/JumpCloud Module/en-Us/JumpCloud-help.xml +++ b/PowerShell/JumpCloud Module/en-Us/JumpCloud-help.xml @@ -3481,6 +3481,140 @@ PS C:\> $BackupJcOrganizationResults.User False + + Get-JCCommand + + command + + The command to execute on the server. + + System.String + + System.String + + + None + + + commandType + + Command Type + + System.String + + System.String + + + None + + + launchType + + Launch Type + + System.String + + System.String + + + None + + + listensTo + + Listens To + + System.String + + System.String + + + None + + + name + + Name of the command + + System.String + + System.String + + + None + + + organization + + The ID of the organization + + System.String + + System.String + + + None + + + schedule + + Schedule + + System.String + + System.String + + + None + + + scheduleRepeatType + + When the command will repeat + + System.String + + System.String + + + None + + + trigger + + The name of the command trigger + + System.String + + System.String + + + None + + + returnProperties + + Allows you to return select properties on JumpCloud user objects. Specifying what properties are returned can drastically increase the speed of the API call with a large data set. Valid properties that can be returned are: 'command', 'name','commandType', 'launchType','listensTo','schedule','trigger','scheduleRepeatType','organization' + + + command + name + commandType + launchType + listensTo + schedule + trigger + scheduleRepeatType + organization + + System.String[] + + System.String[] + + + None + + @@ -3495,6 +3629,18 @@ PS C:\> $BackupJcOrganizationResults.User False + + command + + The command to execute on the server. + + System.String + + System.String + + + None + CommandID @@ -3511,8 +3657,124 @@ PS C:\> $BackupJcOrganizationResults.User None + + commandType + + Command Type + + System.String + + System.String + + + None + + + launchType + + Launch Type + + System.String + + System.String + + + None + + + listensTo + + Listens To + + System.String + + System.String + + + None + + + name + + Name of the command + + System.String + + System.String + + + None + + + organization + + The ID of the organization + + System.String + + System.String + + + None + + + returnProperties + + Allows you to return select properties on JumpCloud user objects. Specifying what properties are returned can drastically increase the speed of the API call with a large data set. Valid properties that can be returned are: 'command', 'name','commandType', 'launchType','listensTo','schedule','trigger','scheduleRepeatType','organization' + + System.String[] + + System.String[] + + + None + + + schedule + + Schedule + + System.String + + System.String + + + None + + + scheduleRepeatType + + When the command will repeat + + System.String + + System.String + + + None + + + trigger + + The name of the command trigger + + System.String + + System.String + + + None + + + + System.String + + + + + System.String[] From 0b01fb4b04d0a182df2a82a5f25ccfc3e1d07775 Mon Sep 17 00:00:00 2001 From: Ken Maranion Date: Tue, 21 Jun 2022 13:55:30 -0700 Subject: [PATCH 06/13] removed listensTo --- PowerShell/JumpCloud Module/Public/Commands/Get-JCCommand.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PowerShell/JumpCloud Module/Public/Commands/Get-JCCommand.ps1 b/PowerShell/JumpCloud Module/Public/Commands/Get-JCCommand.ps1 index 4f0e9dc23..bedf0ff54 100644 --- a/PowerShell/JumpCloud Module/Public/Commands/Get-JCCommand.ps1 +++ b/PowerShell/JumpCloud Module/Public/Commands/Get-JCCommand.ps1 @@ -25,8 +25,8 @@ Function Get-JCCommand () [string]$scheduleRepeatType, [Parameter( ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', Position = 0, HelpMessage = 'The ID of the organization')] [string]$organization, - [Parameter(ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', HelpMessage = 'Allows you to return select properties on JumpCloud user objects. Specifying what properties are returned can drastically increase the speed of the API call with a large data set. Valid properties that can be returned are: ''command'', ''name'',''commandType'', ''launchType'',''listensTo'',''schedule'',''trigger'',''scheduleRepeatType'',''organization''')] - [ValidateSet('command', 'name', 'commandType', 'launchType', 'listensTo', 'schedule', 'trigger', 'scheduleRepeatType', 'organization')] + [Parameter(ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', HelpMessage = 'Allows you to return select properties on JumpCloud user objects. Specifying what properties are returned can drastically increase the speed of the API call with a large data set. Valid properties that can be returned are: ''command'', ''name'',''commandType'', ''launchType'',''schedule'',''trigger'',''scheduleRepeatType'',''organization''')] + [ValidateSet('command', 'name', 'commandType', 'launchType', 'schedule', 'trigger', 'scheduleRepeatType', 'organization')] [String[]]$returnProperties, #### NEW PARAMS END [Parameter(Mandatory, From 0009f6c895ef1b7c396b332638cb04f46c1f4761 Mon Sep 17 00:00:00 2001 From: TheJumpCloud Date: Tue, 21 Jun 2022 21:05:58 +0000 Subject: [PATCH 07/13] Updating PowerShell Module;[skip ci] --- PowerShell/JumpCloud Module/Docs/Get-JCCommand.md | 2 +- PowerShell/JumpCloud Module/en-Us/JumpCloud-help.xml | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/PowerShell/JumpCloud Module/Docs/Get-JCCommand.md b/PowerShell/JumpCloud Module/Docs/Get-JCCommand.md index 8c9fc1af0..4bf261bf6 100644 --- a/PowerShell/JumpCloud Module/Docs/Get-JCCommand.md +++ b/PowerShell/JumpCloud Module/Docs/Get-JCCommand.md @@ -201,7 +201,7 @@ Allows you to return select properties on JumpCloud user objects. Specifying wha Type: System.String[] Parameter Sets: SearchFilter Aliases: -Accepted values: command, name, commandType, launchType, listensTo, schedule, trigger, scheduleRepeatType, organization +Accepted values: command, name, commandType, launchType, schedule, trigger, scheduleRepeatType, organization Required: False Position: Named diff --git a/PowerShell/JumpCloud Module/en-Us/JumpCloud-help.xml b/PowerShell/JumpCloud Module/en-Us/JumpCloud-help.xml index 015101147..368b527fb 100644 --- a/PowerShell/JumpCloud Module/en-Us/JumpCloud-help.xml +++ b/PowerShell/JumpCloud Module/en-Us/JumpCloud-help.xml @@ -3601,7 +3601,6 @@ PS C:\> $BackupJcOrganizationResults.User name commandType launchType - listensTo schedule trigger scheduleRepeatType From 2179c60e79baf5240252384097f831a1a789fe49 Mon Sep 17 00:00:00 2001 From: Ken Maranion Date: Tue, 21 Jun 2022 14:35:04 -0700 Subject: [PATCH 08/13] test --- PowerShell/JumpCloud Module/Public/Commands/Get-JCCommand.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PowerShell/JumpCloud Module/Public/Commands/Get-JCCommand.ps1 b/PowerShell/JumpCloud Module/Public/Commands/Get-JCCommand.ps1 index bedf0ff54..d177ea3ae 100644 --- a/PowerShell/JumpCloud Module/Public/Commands/Get-JCCommand.ps1 +++ b/PowerShell/JumpCloud Module/Public/Commands/Get-JCCommand.ps1 @@ -25,7 +25,7 @@ Function Get-JCCommand () [string]$scheduleRepeatType, [Parameter( ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', Position = 0, HelpMessage = 'The ID of the organization')] [string]$organization, - [Parameter(ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', HelpMessage = 'Allows you to return select properties on JumpCloud user objects. Specifying what properties are returned can drastically increase the speed of the API call with a large data set. Valid properties that can be returned are: ''command'', ''name'',''commandType'', ''launchType'',''schedule'',''trigger'',''scheduleRepeatType'',''organization''')] + [Parameter(ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', HelpMessage = 'Allows you to return select properties on JumpCloud commands objects. Specifying what properties are returned can drastically increase the speed of the API call with a large data set. Valid properties that can be returned are: ''command'', ''name'',''commandType'', ''launchType'',''schedule'',''trigger'',''scheduleRepeatType'',''organization''')] [ValidateSet('command', 'name', 'commandType', 'launchType', 'schedule', 'trigger', 'scheduleRepeatType', 'organization')] [String[]]$returnProperties, #### NEW PARAMS END From dd6e7130a814fecc2cab260b23e5e28e73527daf Mon Sep 17 00:00:00 2001 From: Joe Workman Date: Tue, 21 Jun 2022 20:00:25 -0600 Subject: [PATCH 09/13] updated command examples [skip ci] --- .../JumpCloud Module/Docs/Get-JCCommand.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/PowerShell/JumpCloud Module/Docs/Get-JCCommand.md b/PowerShell/JumpCloud Module/Docs/Get-JCCommand.md index 4bf261bf6..549f3fb8e 100644 --- a/PowerShell/JumpCloud Module/Docs/Get-JCCommand.md +++ b/PowerShell/JumpCloud Module/Docs/Get-JCCommand.md @@ -54,13 +54,30 @@ Note that when running this command the time for the output to display will be d ### Example 4 ```powershell -PS C:\> Get-JCCommand | Where-Object launchType -EQ 'trigger' | Get-JCCommand -ByID +PS C:\> Get-JCCommand -name '*BitLocker*' | Get-JCCommand -ByID +``` + +Returns all information describing all JumpCloud commands with a name of '*trigger*' by passing the -CommandID Parameter to the -ByID Parameter using the pipeline and Parameter Binding. Note, search parameters on Get-JCCommand support wildcard characters. In this example commands with the name BitLocker somewhere in the name would be returned. + +Note that when running this command the time for the output to display will be directly proportionate to how many JumpCloud commands you have with a launchType of 'trigger'. The command 'Get-JCCommand -ByID' runs once for every JumpCloud command within your tenant with a launchType of 'trigger'. +### Example 5 +```powershell +PS C:\> Get-JCCommand -launchType 'trigger' | Get-JCCommand -ByID ``` Returns all information describing all JumpCloud commands with a launchType of 'trigger' by passing the -CommandID Parameter to the -ByID Parameter using the pipeline 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 you have with a launchType of 'trigger'. The command 'Get-JCCommand -ByID' runs once for every JumpCloud command within your tenant with a launchType of 'trigger'. +### Example 6 +```powershell +PS C:\> Get-JCCommand -command '*fdesetup*' | Get-JCCommand -ByID +``` + +Returns all information describing all JumpCloud commands with a command string and the search term "fdesetup", by passing the -CommandID Parameter to the -ByID Parameter using the pipeline and Parameter Binding. Note, search parameters on Get-JCCommand support wildcard characters. In this example commands with the string "fdesetup" somewhere in the command body would be returned. + +Note that when running this command the time for the output to display will be directly proportionate to how many JumpCloud commands you have with a launchType of 'trigger'. The command 'Get-JCCommand -ByID' runs once for every JumpCloud command within your tenant with a launchType of 'trigger'. + ## PARAMETERS ### -ByID From 60ec0f59922b76318d0c8a0b71a0d38f3ba5b6bf Mon Sep 17 00:00:00 2001 From: Ken Maranion Date: Wed, 22 Jun 2022 10:33:10 -0700 Subject: [PATCH 10/13] parameter and test changes --- .../Public/Commands/Get-JCCommand.ps1 | 27 ++++++++----------- .../Public/Commands/Get-JCCommand.tests.ps1 | 12 --------- 2 files changed, 11 insertions(+), 28 deletions(-) diff --git a/PowerShell/JumpCloud Module/Public/Commands/Get-JCCommand.ps1 b/PowerShell/JumpCloud Module/Public/Commands/Get-JCCommand.ps1 index d177ea3ae..8e044ddaf 100644 --- a/PowerShell/JumpCloud Module/Public/Commands/Get-JCCommand.ps1 +++ b/PowerShell/JumpCloud Module/Public/Commands/Get-JCCommand.ps1 @@ -6,29 +6,24 @@ Function Get-JCCommand () param ( - #### NEW PARAMS - [Parameter( ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', Position = 0, HelpMessage = 'The command to execute on the server.')] + [Parameter( ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', Position = 0, HelpMessage = 'The command body text of the JumpCloud Command you wish to search for ex. Get-JCCommand -command ')] [String]$command, - [Parameter( ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', Position = 0, HelpMessage = 'Name of the command')] + [Parameter( ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', Position = 0, HelpMessage = 'The name of the JumpCloud Command you wish to search for ex. Get-JCCommand -name ')] [String]$name, - [Parameter( ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', Position = 0, HelpMessage = 'Command Type')] + [Parameter( ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', Position = 0, HelpMessage = 'The type (windows, mac, linux) of the JumpCloud Command you wish to search for ex. Get-JCCommand -commandType ')] + [ValidateSet('windows', 'mac', 'linux')] [string]$commandType, - [Parameter( ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', Position = 0, HelpMessage = 'Launch Type')] + [Parameter( ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', Position = 0, HelpMessage = 'The launch type of the JumpCloud Command you wish to search for ex. Get-JCCommand -launchType ' )] + [ValidateSet('repeated','one-time','manual', 'trigger')] [string]$launchType, - [Parameter( ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', Position = 0, HelpMessage = 'Listens To')] - [string]$listensTo, - [Parameter( ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', Position = 0, HelpMessage = 'Schedule')] - [string]$schedule, - [Parameter( ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', Position = 0, HelpMessage = 'The name of the command trigger')] + [Parameter( ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', Position = 0, HelpMessage = 'The trigger name of the JumpCloud Command you wish to search for ex. Get-JCCommand -trigger ')] [string]$trigger, - [Parameter( ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', Position = 0, HelpMessage = 'When the command will repeat')] + [Parameter( ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', Position = 0, HelpMessage = 'The scheduled command repeat type (minute, hour, day, week, month) of the JumpCloud Command you wish to search for ex. Get-JCCommand -scheduleRepeatType ')] + [ValidateSet('minute', 'hour', 'day', 'week', 'month')] [string]$scheduleRepeatType, - [Parameter( ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', Position = 0, HelpMessage = 'The ID of the organization')] - [string]$organization, - [Parameter(ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', HelpMessage = 'Allows you to return select properties on JumpCloud commands objects. Specifying what properties are returned can drastically increase the speed of the API call with a large data set. Valid properties that can be returned are: ''command'', ''name'',''commandType'', ''launchType'',''schedule'',''trigger'',''scheduleRepeatType'',''organization''')] - [ValidateSet('command', 'name', 'commandType', 'launchType', 'schedule', 'trigger', 'scheduleRepeatType', 'organization')] + [Parameter(ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', HelpMessage = 'Allows you to return select properties on JumpCloud commands objects. Specifying what properties are returned can drastically increase the speed of the API call with a large data set. Valid properties that can be returned are: ''command'', ''name'',''launchType'',''commandType'',''trigger'',''scheduleRepeatType''')] + [ValidateSet('command', 'name', 'launchType', 'commandType','trigger', 'scheduleRepeatType')] [String[]]$returnProperties, - #### NEW PARAMS END [Parameter(Mandatory, ValueFromPipelineByPropertyName, ParameterSetName = 'ByID', diff --git a/PowerShell/JumpCloud Module/Tests/Public/Commands/Get-JCCommand.tests.ps1 b/PowerShell/JumpCloud Module/Tests/Public/Commands/Get-JCCommand.tests.ps1 index dd80aaa39..7c40643bd 100755 --- a/PowerShell/JumpCloud Module/Tests/Public/Commands/Get-JCCommand.tests.ps1 +++ b/PowerShell/JumpCloud Module/Tests/Public/Commands/Get-JCCommand.tests.ps1 @@ -62,14 +62,6 @@ Describe -Tag('JCCommand') 'Get-JCCommand Search' { $Command = Get-JCCommand -launchType $PesterParams_Command1.launchType $Command.launchType | Should -Be $PesterParams_Command1.launchType } - It "Searches a JumpCloud command by listensTo" { - $Command = Get-JCCommand -listensTo $PesterParams_Command1.listensTo - $Command.listensTo | Should -Be $PesterParams_Command1.listensTo - } - It "Searches a JumpCloud command by schedule" { - $Command = Get-JCCommand -schedule $PesterParams_Command1.schedule - $Command.schedule | Should -Be $PesterParams_Command1.schedule - } It "Searches a JumpCloud command by trigger" { $Command = Get-JCCommand -trigger $PesterParams_Command1.trigger $Command.trigger | Should -Be $PesterParams_Command1.trigger @@ -78,8 +70,4 @@ Describe -Tag('JCCommand') 'Get-JCCommand Search' { $Command = Get-JCCommand -scheduleRepeatType $PesterParams_Command1.scheduleRepeatType $Command.scheduleRepeatType | Should -Be $PesterParams_Command1.scheduleRepeatType } - It "Searches a JumpCloud command by organization" { - $Command = Get-JCCommand -organization $PesterParams_Command1.organization - $Command.organization | Should -Be $PesterParams_Command1.organization - } } \ No newline at end of file From 29f9ff1f551b1faf36d67ad1216c200441d5abfc Mon Sep 17 00:00:00 2001 From: TheJumpCloud Date: Wed, 22 Jun 2022 17:44:01 +0000 Subject: [PATCH 11/13] Updating PowerShell Module;[skip ci] --- .../JumpCloud Module/Docs/Get-JCCommand.md | 52 +-------- PowerShell/JumpCloud Module/JumpCloud.psd1 | 2 +- .../JumpCloud Module/en-Us/JumpCloud-help.xml | 101 +++++------------- 3 files changed, 30 insertions(+), 125 deletions(-) diff --git a/PowerShell/JumpCloud Module/Docs/Get-JCCommand.md b/PowerShell/JumpCloud Module/Docs/Get-JCCommand.md index 549f3fb8e..0fd80a6d4 100644 --- a/PowerShell/JumpCloud Module/Docs/Get-JCCommand.md +++ b/PowerShell/JumpCloud Module/Docs/Get-JCCommand.md @@ -15,8 +15,7 @@ Returns all JumpCloud Commands within a JumpCloud tenant or a single JumpCloud C ### SearchFilter (Default) ``` Get-JCCommand [[-command] ] [[-name] ] [[-commandType] ] [[-launchType] ] - [[-listensTo] ] [[-schedule] ] [[-trigger] ] [[-scheduleRepeatType] ] - [[-organization] ] [-returnProperties ] [] + [[-trigger] ] [[-scheduleRepeatType] ] [-returnProperties ] [] ``` ### ByID @@ -60,6 +59,7 @@ PS C:\> Get-JCCommand -name '*BitLocker*' | Get-JCCommand -ByID Returns all information describing all JumpCloud commands with a name of '*trigger*' by passing the -CommandID Parameter to the -ByID Parameter using the pipeline and Parameter Binding. Note, search parameters on Get-JCCommand support wildcard characters. In this example commands with the name BitLocker somewhere in the name would be returned. Note that when running this command the time for the output to display will be directly proportionate to how many JumpCloud commands you have with a launchType of 'trigger'. The command 'Get-JCCommand -ByID' runs once for every JumpCloud command within your tenant with a launchType of 'trigger'. + ### Example 5 ```powershell PS C:\> Get-JCCommand -launchType 'trigger' | Get-JCCommand -ByID @@ -166,21 +166,6 @@ Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` -### -listensTo -Listens To - -```yaml -Type: System.String -Parameter Sets: SearchFilter -Aliases: - -Required: False -Position: 0 -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - ### -name Name of the command @@ -196,21 +181,6 @@ Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` -### -organization -The ID of the organization - -```yaml -Type: System.String -Parameter Sets: SearchFilter -Aliases: - -Required: False -Position: 0 -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - ### -returnProperties Allows you to return select properties on JumpCloud user objects. Specifying what properties are returned can drastically increase the speed of the API call with a large data set. Valid properties that can be returned are: 'command', 'name','commandType', 'launchType','listensTo','schedule','trigger','scheduleRepeatType','organization' @@ -218,7 +188,7 @@ Allows you to return select properties on JumpCloud user objects. Specifying wha Type: System.String[] Parameter Sets: SearchFilter Aliases: -Accepted values: command, name, commandType, launchType, schedule, trigger, scheduleRepeatType, organization +Accepted values: command, name, launchType, commandType, trigger, scheduleRepeatType Required: False Position: Named @@ -227,21 +197,6 @@ Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` -### -schedule -Schedule - -```yaml -Type: System.String -Parameter Sets: SearchFilter -Aliases: - -Required: False -Position: 0 -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - ### -scheduleRepeatType When the command will repeat @@ -249,6 +204,7 @@ When the command will repeat Type: System.String Parameter Sets: SearchFilter Aliases: +Accepted values: minute, hour, day, week, month Required: False Position: 0 diff --git a/PowerShell/JumpCloud Module/JumpCloud.psd1 b/PowerShell/JumpCloud Module/JumpCloud.psd1 index 8aa62ced7..7dda14111 100755 --- a/PowerShell/JumpCloud Module/JumpCloud.psd1 +++ b/PowerShell/JumpCloud Module/JumpCloud.psd1 @@ -3,7 +3,7 @@ # # Generated by: JumpCloud Solutions Architect Team # -# Generated on: 6/21/2022 +# Generated on: 6/22/2022 # @{ diff --git a/PowerShell/JumpCloud Module/en-Us/JumpCloud-help.xml b/PowerShell/JumpCloud Module/en-Us/JumpCloud-help.xml index 368b527fb..59d67cfb3 100644 --- a/PowerShell/JumpCloud Module/en-Us/JumpCloud-help.xml +++ b/PowerShell/JumpCloud Module/en-Us/JumpCloud-help.xml @@ -3519,18 +3519,6 @@ PS C:\> $BackupJcOrganizationResults.User None - - listensTo - - Listens To - - System.String - - System.String - - - None - name @@ -3543,35 +3531,18 @@ PS C:\> $BackupJcOrganizationResults.User None - - organization - - The ID of the organization - - System.String - - System.String - - - None - - - schedule - - Schedule - - System.String - - System.String - - - None - scheduleRepeatType When the command will repeat + + minute + hour + day + week + month + System.String System.String @@ -3599,12 +3570,10 @@ PS C:\> $BackupJcOrganizationResults.User command name - commandType launchType - schedule + commandType trigger scheduleRepeatType - organization System.String[] @@ -3680,18 +3649,6 @@ PS C:\> $BackupJcOrganizationResults.User None - - listensTo - - Listens To - - System.String - - System.String - - - None - name @@ -3704,18 +3661,6 @@ PS C:\> $BackupJcOrganizationResults.User None - - organization - - The ID of the organization - - System.String - - System.String - - - None - returnProperties @@ -3728,18 +3673,6 @@ PS C:\> $BackupJcOrganizationResults.User None - - schedule - - Schedule - - System.String - - System.String - - - None - scheduleRepeatType @@ -3823,12 +3756,28 @@ PS C:\> $BackupJcOrganizationResults.User -------------------------- Example 4 -------------------------- - PS C:\> Get-JCCommand | Where-Object launchType -EQ 'trigger' | Get-JCCommand -ByID + PS C:\> Get-JCCommand -name '*BitLocker*' | Get-JCCommand -ByID + + Returns all information describing all JumpCloud commands with a name of ' trigger ' by passing the -CommandID Parameter to the -ByID Parameter using the pipeline and Parameter Binding. Note, search parameters on Get-JCCommand support wildcard characters. In this example commands with the name BitLocker somewhere in the name would be returned. + Note that when running this command the time for the output to display will be directly proportionate to how many JumpCloud commands you have with a launchType of 'trigger'. The command 'Get-JCCommand -ByID' runs once for every JumpCloud command within your tenant with a launchType of 'trigger'. + + + + -------------------------- Example 5 -------------------------- + PS C:\> Get-JCCommand -launchType 'trigger' | Get-JCCommand -ByID Returns all information describing all JumpCloud commands with a launchType of 'trigger' by passing the -CommandID Parameter to the -ByID Parameter using the pipeline 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 you have with a launchType of 'trigger'. The command 'Get-JCCommand -ByID' runs once for every JumpCloud command within your tenant with a launchType of 'trigger'. + + -------------------------- Example 6 -------------------------- + PS C:\> Get-JCCommand -command '*fdesetup*' | Get-JCCommand -ByID + + Returns all information describing all JumpCloud commands with a command string and the search term "fdesetup", by passing the -CommandID Parameter to the -ByID Parameter using the pipeline and Parameter Binding. Note, search parameters on Get-JCCommand support wildcard characters. In this example commands with the string "fdesetup" somewhere in the command body would be returned. + Note that when running this command the time for the output to display will be directly proportionate to how many JumpCloud commands you have with a launchType of 'trigger'. The command 'Get-JCCommand -ByID' runs once for every JumpCloud command within your tenant with a launchType of 'trigger'. + + From cdf029829c161dbf7b0a93d615d717e940bc2758 Mon Sep 17 00:00:00 2001 From: Joe Workman Date: Wed, 22 Jun 2022 14:29:00 -0600 Subject: [PATCH 12/13] position changes/ tests updated/ ready for release --- .circleci/workflows.yml | 2 +- .../Public/Commands/Get-JCCommand.ps1 | 12 ++++---- .../Public/Commands/Get-JCCommand.tests.ps1 | 30 +++++++++---------- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/.circleci/workflows.yml b/.circleci/workflows.yml index 8e4572fba..fd4ddf8a4 100755 --- a/.circleci/workflows.yml +++ b/.circleci/workflows.yml @@ -45,7 +45,7 @@ parameters: PublishToPSGallery: description: 'When `true` and when run against Master branch, this workflow will publish the latest code to PSGallery' type: boolean - default: false + default: true ManualModuleVersion: description: 'When `true` the pipeline will use the Module Version specified in JumpCloud Module JumpCloud.psd1 file' type: boolean diff --git a/PowerShell/JumpCloud Module/Public/Commands/Get-JCCommand.ps1 b/PowerShell/JumpCloud Module/Public/Commands/Get-JCCommand.ps1 index 8e044ddaf..03be16e3f 100644 --- a/PowerShell/JumpCloud Module/Public/Commands/Get-JCCommand.ps1 +++ b/PowerShell/JumpCloud Module/Public/Commands/Get-JCCommand.ps1 @@ -6,19 +6,19 @@ Function Get-JCCommand () param ( - [Parameter( ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', Position = 0, HelpMessage = 'The command body text of the JumpCloud Command you wish to search for ex. Get-JCCommand -command ')] + [Parameter( ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', HelpMessage = 'The command body text of the JumpCloud Command you wish to search for ex. Get-JCCommand -command ')] [String]$command, - [Parameter( ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', Position = 0, HelpMessage = 'The name of the JumpCloud Command you wish to search for ex. Get-JCCommand -name ')] + [Parameter( ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', HelpMessage = 'The name of the JumpCloud Command you wish to search for ex. Get-JCCommand -name ')] [String]$name, - [Parameter( ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', Position = 0, HelpMessage = 'The type (windows, mac, linux) of the JumpCloud Command you wish to search for ex. Get-JCCommand -commandType ')] + [Parameter( ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', HelpMessage = 'The type (windows, mac, linux) of the JumpCloud Command you wish to search for ex. Get-JCCommand -commandType ')] [ValidateSet('windows', 'mac', 'linux')] [string]$commandType, - [Parameter( ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', Position = 0, HelpMessage = 'The launch type of the JumpCloud Command you wish to search for ex. Get-JCCommand -launchType ' )] + [Parameter( ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', HelpMessage = 'The launch type of the JumpCloud Command you wish to search for ex. Get-JCCommand -launchType ' )] [ValidateSet('repeated','one-time','manual', 'trigger')] [string]$launchType, - [Parameter( ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', Position = 0, HelpMessage = 'The trigger name of the JumpCloud Command you wish to search for ex. Get-JCCommand -trigger ')] + [Parameter( ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', HelpMessage = 'The trigger name of the JumpCloud Command you wish to search for ex. Get-JCCommand -trigger ')] [string]$trigger, - [Parameter( ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', Position = 0, HelpMessage = 'The scheduled command repeat type (minute, hour, day, week, month) of the JumpCloud Command you wish to search for ex. Get-JCCommand -scheduleRepeatType ')] + [Parameter( ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', HelpMessage = 'The scheduled command repeat type (minute, hour, day, week, month) of the JumpCloud Command you wish to search for ex. Get-JCCommand -scheduleRepeatType ')] [ValidateSet('minute', 'hour', 'day', 'week', 'month')] [string]$scheduleRepeatType, [Parameter(ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', HelpMessage = 'Allows you to return select properties on JumpCloud commands objects. Specifying what properties are returned can drastically increase the speed of the API call with a large data set. Valid properties that can be returned are: ''command'', ''name'',''launchType'',''commandType'',''trigger'',''scheduleRepeatType''')] diff --git a/PowerShell/JumpCloud Module/Tests/Public/Commands/Get-JCCommand.tests.ps1 b/PowerShell/JumpCloud Module/Tests/Public/Commands/Get-JCCommand.tests.ps1 index 7c40643bd..5f32315f0 100755 --- a/PowerShell/JumpCloud Module/Tests/Public/Commands/Get-JCCommand.tests.ps1 +++ b/PowerShell/JumpCloud Module/Tests/Public/Commands/Get-JCCommand.tests.ps1 @@ -16,7 +16,6 @@ Describe -Tag:('JCCommand') 'Get-JCCommand 1.0' { $SingleCommand = Get-JCCommand | Select-Object -Last 1 $SingleResult = Get-JCCommand $SingleCommand._id $SingleResult._id.Count | Should -Be 1 - } It "Gets a single JumpCloud command using -ByID passed through the pipeline" { @@ -42,32 +41,33 @@ Describe -Tag:('JCCommand') 'Get-JCCommand 1.0' { } Describe -Tag('JCCommand') 'Get-JCCommand Search' { - BeforeAll { + BeforeAll { Connect-JCOnline -JumpCloudApiKey:($PesterParams_ApiKey) -force | Out-Null - $PesterParams_Command1 = Get-JCCommand -CommandID:($PesterParams_Command1.Id) + # Get Command3 because it does not contain a wildcard + $PesterParams_Command3 = Get-JCCommand -CommandID:($PesterParams_Command3.Id) } It "Searches a JumpCloud command by name" { - $Command = Get-JCCommand -name $PesterParams_Command1.name - $Command.name | Should -Be $PesterParams_Command1.name + $Command = Get-JCCommand -name $PesterParams_Command3.name + $Command.name | Should -Be $PesterParams_Command3.name } It "Searches a JumpCloud command by command" { - $Command = Get-JCCommand -command $PesterParams_Command1.command - $Command.command | Should -Be $PesterParams_Command1.command + $Command = Get-JCCommand -command $PesterParams_Command3.command + $Command.command | Should -Be $PesterParams_Command3.command } It "Searches a JumpCloud command by commandType" { - $Command = Get-JCCommand -commandType $PesterParams_Command1.commandType - $Command.commandType | Should -Be $PesterParams_Command1.commandType + $Command = Get-JCCommand -commandType $PesterParams_Command3.commandType + $Command.commandType | Should -Bein $PesterParams_Command3.commandType } It "Searches a JumpCloud command by launchType" { - $Command = Get-JCCommand -launchType $PesterParams_Command1.launchType - $Command.launchType | Should -Be $PesterParams_Command1.launchType + $Command = Get-JCCommand -launchType $PesterParams_Command3.launchType + $Command.launchType | Should -Bein $PesterParams_Command3.launchType } It "Searches a JumpCloud command by trigger" { - $Command = Get-JCCommand -trigger $PesterParams_Command1.trigger - $Command.trigger | Should -Be $PesterParams_Command1.trigger + $Command = Get-JCCommand -trigger $PesterParams_Command3.trigger + $Command.trigger | Should -Be $PesterParams_Command3.trigger } It "Searches a JumpCloud command by scheduleRepeatType" { - $Command = Get-JCCommand -scheduleRepeatType $PesterParams_Command1.scheduleRepeatType - $Command.scheduleRepeatType | Should -Be $PesterParams_Command1.scheduleRepeatType + $Command = Get-JCCommand -scheduleRepeatType $PesterParams_Command3.scheduleRepeatType + $Command.scheduleRepeatType | Should -Bein $PesterParams_Command3.scheduleRepeatType } } \ No newline at end of file From 6d2aa239e4dcf74076d069323479e523033527f6 Mon Sep 17 00:00:00 2001 From: TheJumpCloud Date: Wed, 22 Jun 2022 20:39:31 +0000 Subject: [PATCH 13/13] Updating PowerShell Module;[skip ci] --- .../JumpCloud Module/Docs/Get-JCCommand.md | 18 +++-- .../JumpCloud Module/en-Us/JumpCloud-help.xml | 75 +++++++++++-------- 2 files changed, 53 insertions(+), 40 deletions(-) diff --git a/PowerShell/JumpCloud Module/Docs/Get-JCCommand.md b/PowerShell/JumpCloud Module/Docs/Get-JCCommand.md index 0fd80a6d4..ece9505be 100644 --- a/PowerShell/JumpCloud Module/Docs/Get-JCCommand.md +++ b/PowerShell/JumpCloud Module/Docs/Get-JCCommand.md @@ -14,8 +14,8 @@ Returns all JumpCloud Commands within a JumpCloud tenant or a single JumpCloud C ### SearchFilter (Default) ``` -Get-JCCommand [[-command] ] [[-name] ] [[-commandType] ] [[-launchType] ] - [[-trigger] ] [[-scheduleRepeatType] ] [-returnProperties ] [] +Get-JCCommand [-command ] [-name ] [-commandType ] [-launchType ] + [-trigger ] [-scheduleRepeatType ] [-returnProperties ] [] ``` ### ByID @@ -105,7 +105,7 @@ Parameter Sets: SearchFilter Aliases: Required: False -Position: 0 +Position: Named Default value: None Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False @@ -143,9 +143,10 @@ Command Type Type: System.String Parameter Sets: SearchFilter Aliases: +Accepted values: windows, mac, linux Required: False -Position: 0 +Position: Named Default value: None Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False @@ -158,9 +159,10 @@ Launch Type Type: System.String Parameter Sets: SearchFilter Aliases: +Accepted values: repeated, one-time, manual, trigger Required: False -Position: 0 +Position: Named Default value: None Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False @@ -175,7 +177,7 @@ Parameter Sets: SearchFilter Aliases: Required: False -Position: 0 +Position: Named Default value: None Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False @@ -207,7 +209,7 @@ Aliases: Accepted values: minute, hour, day, week, month Required: False -Position: 0 +Position: Named Default value: None Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False @@ -222,7 +224,7 @@ Parameter Sets: SearchFilter Aliases: Required: False -Position: 0 +Position: Named Default value: None Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False diff --git a/PowerShell/JumpCloud Module/en-Us/JumpCloud-help.xml b/PowerShell/JumpCloud Module/en-Us/JumpCloud-help.xml index 59d67cfb3..85a77563c 100644 --- a/PowerShell/JumpCloud Module/en-Us/JumpCloud-help.xml +++ b/PowerShell/JumpCloud Module/en-Us/JumpCloud-help.xml @@ -3483,7 +3483,7 @@ PS C:\> $BackupJcOrganizationResults.User Get-JCCommand - + command The command to execute on the server. @@ -3495,11 +3495,16 @@ PS C:\> $BackupJcOrganizationResults.User None - + commandType Command Type + + windows + mac + linux + System.String System.String @@ -3507,11 +3512,17 @@ PS C:\> $BackupJcOrganizationResults.User None - + launchType Launch Type + + repeated + one-time + manual + trigger + System.String System.String @@ -3519,7 +3530,7 @@ PS C:\> $BackupJcOrganizationResults.User None - + name Name of the command @@ -3531,7 +3542,27 @@ PS C:\> $BackupJcOrganizationResults.User None - + + returnProperties + + Allows you to return select properties on JumpCloud user objects. Specifying what properties are returned can drastically increase the speed of the API call with a large data set. Valid properties that can be returned are: 'command', 'name','commandType', 'launchType','listensTo','schedule','trigger','scheduleRepeatType','organization' + + + command + name + launchType + commandType + trigger + scheduleRepeatType + + System.String[] + + System.String[] + + + None + + scheduleRepeatType When the command will repeat @@ -3550,7 +3581,7 @@ PS C:\> $BackupJcOrganizationResults.User None - + trigger The name of the command trigger @@ -3562,26 +3593,6 @@ PS C:\> $BackupJcOrganizationResults.User None - - returnProperties - - Allows you to return select properties on JumpCloud user objects. Specifying what properties are returned can drastically increase the speed of the API call with a large data set. Valid properties that can be returned are: 'command', 'name','commandType', 'launchType','listensTo','schedule','trigger','scheduleRepeatType','organization' - - - command - name - launchType - commandType - trigger - scheduleRepeatType - - System.String[] - - System.String[] - - - None - @@ -3597,7 +3608,7 @@ PS C:\> $BackupJcOrganizationResults.User False - + command The command to execute on the server. @@ -3625,7 +3636,7 @@ PS C:\> $BackupJcOrganizationResults.User None - + commandType Command Type @@ -3637,7 +3648,7 @@ PS C:\> $BackupJcOrganizationResults.User None - + launchType Launch Type @@ -3649,7 +3660,7 @@ PS C:\> $BackupJcOrganizationResults.User None - + name Name of the command @@ -3673,7 +3684,7 @@ PS C:\> $BackupJcOrganizationResults.User None - + scheduleRepeatType When the command will repeat @@ -3685,7 +3696,7 @@ PS C:\> $BackupJcOrganizationResults.User None - + trigger The name of the command trigger