diff --git a/PowerShell/JumpCloud Module/Docs/Get-JCEvent.md b/PowerShell/JumpCloud Module/Docs/Get-JCEvent.md index c5e76fd60..21b935ce8 100644 --- a/PowerShell/JumpCloud Module/Docs/Get-JCEvent.md +++ b/PowerShell/JumpCloud Module/Docs/Get-JCEvent.md @@ -15,8 +15,8 @@ Query the API for Directory Insights events ### GetExpanded (Default) ``` Get-JCEvent -Service -StartTime [-EndTime ] [-Fields ] - [-SearchAfter ] [-SearchTermAnd ] [-SearchTermOr ] [-Sort ] [-WhatIf] - [-Confirm] [] + [-SearchAfter ] [-SearchTermAnd ] [-SearchTermOr ] + [-Sort ] [-WhatIf] [-Confirm] [] ``` ### Get @@ -137,7 +137,7 @@ Accept wildcard characters: False Specific query to search after, see x-* response headers for next values ```yaml -Type: System.String[] +Type: JumpCloud.SDK.DirectoryInsights.Models.IEventQuerySearchAfterItem[] Parameter Sets: GetExpanded Aliases: @@ -264,7 +264,6 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS ### JumpCloud.SDK.DirectoryInsights.Models.IPost200ApplicationJsonItemsItem -### System.String ## NOTES COMPLEX PARAMETER PROPERTIES To create the parameters described below, construct a hash table containing the appropriate properties. diff --git a/PowerShell/JumpCloud Module/Docs/Get-JCEventCount.md b/PowerShell/JumpCloud Module/Docs/Get-JCEventCount.md index 7d97c199a..e4b5e4e64 100644 --- a/PowerShell/JumpCloud Module/Docs/Get-JCEventCount.md +++ b/PowerShell/JumpCloud Module/Docs/Get-JCEventCount.md @@ -15,8 +15,8 @@ Query the API for a count of matching events ### GetExpanded (Default) ``` Get-JCEventCount -Service -StartTime [-EndTime ] [-Fields ] - [-SearchAfter ] [-SearchTermAnd ] [-SearchTermOr ] [-Sort ] [-WhatIf] - [-Confirm] [] + [-SearchAfter ] [-SearchTermAnd ] [-SearchTermOr ] + [-Sort ] [-WhatIf] [-Confirm] [] ``` ### Get @@ -109,7 +109,7 @@ Accept wildcard characters: False Specific query to search after, see x-* response headers for next values ```yaml -Type: System.String[] +Type: JumpCloud.SDK.DirectoryInsights.Models.IEventQuerySearchAfterItem[] Parameter Sets: GetExpanded Aliases: @@ -236,7 +236,6 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS ### System.Int64 -### System.String ## NOTES COMPLEX PARAMETER PROPERTIES diff --git a/PowerShell/JumpCloud Module/Docs/JumpCloud.md b/PowerShell/JumpCloud Module/Docs/JumpCloud.md index 3097da240..1e15c873b 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.18.3 +Help Version: 1.18.4 Locale: en-US --- diff --git a/PowerShell/JumpCloud Module/Docs/New-JCDeploymentTemplate.md b/PowerShell/JumpCloud Module/Docs/New-JCDeploymentTemplate.md index fc4c357a5..257fb7295 100644 --- a/PowerShell/JumpCloud Module/Docs/New-JCDeploymentTemplate.md +++ b/PowerShell/JumpCloud Module/Docs/New-JCDeploymentTemplate.md @@ -19,6 +19,30 @@ New-JCDeploymentTemplate [] ## DESCRIPTION The New-JCDeploymentTemplate command is a menu driven interactive function that guides admins through the process of creating a command deployment CSV file and assists in gathering the required information needed to populate the command deployment CSV file. +Note: Windows commands and Mac/Linux commands interpret variables differently. Windows commands with variables you wish to replace during Invoke-JCDeployment should be written as `${ENV:$variableToReplace}` within the command body. The header variables of Windows Command Deployment CSVs should be prefixed with `$` + +Example valid Windows PowerShell command: +`Invoke-WebRequest -Uri $url -OutFile ${ENV:$UserPath}\${ENV:$FileName}` + +Example Valid Mac/Linux CSV: +| "SystemID" | "$UserPath" | "$FileName" | +|-------------------------- |------------------------- |----------------------- | +| 602c4806e87bc117c434fb71 | "C:\Users\Joe\Desktop" | "PDF_JoeToSign.pdf" | +| 60623c9d0bab5a18614d4d6d | "C:\Users\Bob\Desktop" | "PDF_BobToSign.pdf" | +| 6025b5aa115b9917f6903436 | "C:\Users\Steve\Desktop" | "PDF_SteveToSign.pdf" | + +Mac and Linux commands work similarly in the sense that command body variables such as `$variableToReplace` will be replaced when running Invoke-JCDeployment. The header variables of a Mac/Linux Command Deployment CSV do not need to be prefixed with `$` + +Example valid Mac/Linux command: +`curl -L -o $UserPath/$FileName $url >/dev/null` + +Example Valid Mac/Linux CSV: +| "SystemID" | "UserPath" | "FileName" | +|-------------------------- |------------------------- |----------------------- | +| 602c4806e87bc117c434fb71 | "/Users/Joe/Desktop" | "PDF_JoeToSign.pdf" | +| 60623c9d0bab5a18614d4d6d | "/Users/Bob/Desktop" | "PDF_BobToSign.pdf" | +| 6025b5aa115b9917f6903436 | "/Users/Steve/Desktop" | "PDF_SteveToSign.pdf" | + ## EXAMPLES ### Example 1 diff --git a/PowerShell/JumpCloud Module/JumpCloud.nuspec b/PowerShell/JumpCloud Module/JumpCloud.nuspec index d25374398..6f4a1fd94 100644 --- a/PowerShell/JumpCloud Module/JumpCloud.nuspec +++ b/PowerShell/JumpCloud Module/JumpCloud.nuspec @@ -2,7 +2,7 @@ JumpCloud - 1.18.3 + 1.18.4 PowerShell functions to manage a JumpCloud Directory-as-a-Service JumpCloud Solutions Architect Team JumpCloud diff --git a/PowerShell/JumpCloud Module/JumpCloud.psd1 b/PowerShell/JumpCloud Module/JumpCloud.psd1 index 2200a85f4..5142289ee 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: 2/9/2021 +# Generated on: 5/3/2021 # @{ @@ -12,7 +12,7 @@ RootModule = 'JumpCloud.psm1' # Version number of this module. -ModuleVersion = '1.18.3' +ModuleVersion = '1.18.4' # Supported PSEditions # CompatiblePSEditions = @() diff --git a/PowerShell/JumpCloud Module/Public/Commands/Invoke-JCDeployment.ps1 b/PowerShell/JumpCloud Module/Public/Commands/Invoke-JCDeployment.ps1 index 4279e5a86..ee5f7ced4 100644 --- a/PowerShell/JumpCloud Module/Public/Commands/Invoke-JCDeployment.ps1 +++ b/PowerShell/JumpCloud Module/Public/Commands/Invoke-JCDeployment.ps1 @@ -145,16 +145,18 @@ The CommandID will be the 24 character string populated for the _id field.')] { $trigger = Get-Date -Format MMddyyTHHmmss - $Command = Set-JCCommand -CommandID $CommandID -launchType trigger -trigger $trigger + # Get existing data, type, Shell from command + $ExistingCommand = Get-JCSDKCommand -Id $CommandID + + # set command w/ origional type and new trigger + $Command = Set-JCSDKCommand -ID $CommandID -launchType trigger -trigger $trigger -Command $ExistingCommand.Command1 -CommandType $ExistingCommand.CommandType -Shell $ExistingCommand.Shell $DeploymentInfo = Import-Csv $CSVFilePath $Variables = $DeploymentInfo[0].psobject.Properties.Name | Where-Object {$_ -ne "SystemID"} [int]$NumberOfVariables = $Variables.Count - [int]$ProgressCounter = 0 - [int]$SystemCount = $DeploymentInfo.SystemID.Count foreach ($Target in $DeploymentInfo) @@ -172,10 +174,9 @@ The CommandID will be the 24 character string populated for the _id field.')] [int]$Counter = 1 - foreach ($Var in $Variables) { - Write-Verbose "Adding PARAMETER: $Var to DEPLOY COMMAND" + Write-Verbose "Adding PARAMETER: $Var with value $($Target | Select-Object -ExpandProperty $var) to DEPLOY COMMAND" $DeploymentParams.Add("Variable" + $($Counter) + "_name", "$Var") $DeploymentParams.Add("Variable" + $($Counter) + "_value", "$($Target | Select-Object -ExpandProperty $var)") @@ -206,12 +207,8 @@ The CommandID will be the 24 character string populated for the _id field.')] $resultsArray += $SingleResult - } - - $null = Set-JCCommand -CommandID $CommandID -launchType manual - - + $null = Set-JCSDKCommand -ID $CommandID -launchType manual -Command $ExistingCommand.Command1 -CommandType $ExistingCommand.CommandType -Shell $ExistingCommand.Shell } end diff --git a/PowerShell/JumpCloud Module/Public/DirectoryInsights/Get-JCEvent.ps1 b/PowerShell/JumpCloud Module/Public/DirectoryInsights/Get-JCEvent.ps1 index 75cdc6d64..328648299 100644 --- a/PowerShell/JumpCloud Module/Public/DirectoryInsights/Get-JCEvent.ps1 +++ b/PowerShell/JumpCloud Module/Public/DirectoryInsights/Get-JCEvent.ps1 @@ -40,8 +40,6 @@ Get all events filtered by organization_update term between a date range JumpCloud.SDK.DirectoryInsights.Models.IEventQuery .Outputs JumpCloud.SDK.DirectoryInsights.Models.IPost200ApplicationJsonItemsItem -.Outputs -System.String .Notes COMPLEX PARAMETER PROPERTIES @@ -53,7 +51,7 @@ BODY : EventQuery is the users' command to search our auth logs [EndTime ]: optional query end time, UTC in RFC3339 format [Fields ]: optional list of fields to return from query [Limit ]: Max number of rows to return - [SearchAfter ]: Specific query to search after, see x-* response headers for next values + [SearchAfter ]: Specific query to search after, see x-* response headers for next values [SearchTermAnd ]: TermConjunction represents a conjunction (and/or) NOTE: the validator limits what the operator can be, not the object for future-proof-ness and a list of sub-values [(Any) ]: This indicates any property can be added to this object. [SearchTermOr ]: TermConjunction represents a conjunction (and/or) NOTE: the validator limits what the operator can be, not the object for future-proof-ness and a list of sub-values @@ -63,7 +61,7 @@ https://github.com/TheJumpCloud/jcapi-powershell/tree/master/SDKs/PowerShell/Jum #> Function Get-JCEvent { - [OutputType([JumpCloud.SDK.DirectoryInsights.Models.IPost200ApplicationJsonItemsItem], [System.String])] + [OutputType([JumpCloud.SDK.DirectoryInsights.Models.IPost200ApplicationJsonItemsItem])] [CmdletBinding(DefaultParameterSetName='GetExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] Param( [Parameter(ParameterSetName='GetExpanded', Mandatory)] @@ -93,7 +91,7 @@ Function Get-JCEvent [Parameter(ParameterSetName='GetExpanded')] [JumpCloud.SDK.DirectoryInsights.Category('Body')] - [System.String[]] + [JumpCloud.SDK.DirectoryInsights.Models.IEventQuerySearchAfterItem[]] # Specific query to search after, see x-* response headers for next values ${SearchAfter}, diff --git a/PowerShell/JumpCloud Module/Public/DirectoryInsights/Get-JCEventCount.ps1 b/PowerShell/JumpCloud Module/Public/DirectoryInsights/Get-JCEventCount.ps1 index ee0651ad3..de86b89ae 100644 --- a/PowerShell/JumpCloud Module/Public/DirectoryInsights/Get-JCEventCount.ps1 +++ b/PowerShell/JumpCloud Module/Public/DirectoryInsights/Get-JCEventCount.ps1 @@ -24,8 +24,6 @@ Get only group_create event counts the last thirty days JumpCloud.SDK.DirectoryInsights.Models.IEventQuery .Outputs System.Int64 -.Outputs -System.String .Notes COMPLEX PARAMETER PROPERTIES @@ -37,7 +35,7 @@ BODY : EventQuery is the users' command to search our auth logs [EndTime ]: optional query end time, UTC in RFC3339 format [Fields ]: optional list of fields to return from query [Limit ]: Max number of rows to return - [SearchAfter ]: Specific query to search after, see x-* response headers for next values + [SearchAfter ]: Specific query to search after, see x-* response headers for next values [SearchTermAnd ]: TermConjunction represents a conjunction (and/or) NOTE: the validator limits what the operator can be, not the object for future-proof-ness and a list of sub-values [(Any) ]: This indicates any property can be added to this object. [SearchTermOr ]: TermConjunction represents a conjunction (and/or) NOTE: the validator limits what the operator can be, not the object for future-proof-ness and a list of sub-values @@ -47,7 +45,7 @@ https://github.com/TheJumpCloud/jcapi-powershell/tree/master/SDKs/PowerShell/Jum #> Function Get-JCEventCount { - [OutputType([System.Int64], [System.String])] + [OutputType([System.Int64])] [CmdletBinding(DefaultParameterSetName='GetExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] Param( [Parameter(ParameterSetName='GetExpanded', Mandatory)] @@ -77,7 +75,7 @@ Function Get-JCEventCount [Parameter(ParameterSetName='GetExpanded')] [JumpCloud.SDK.DirectoryInsights.Category('Body')] - [System.String[]] + [JumpCloud.SDK.DirectoryInsights.Models.IEventQuerySearchAfterItem[]] # Specific query to search after, see x-* response headers for next values ${SearchAfter}, diff --git a/PowerShell/JumpCloud Module/Tests/SetupOrg.ps1 b/PowerShell/JumpCloud Module/Tests/SetupOrg.ps1 index 489ef42b9..20b0efa30 100644 --- a/PowerShell/JumpCloud Module/Tests/SetupOrg.ps1 +++ b/PowerShell/JumpCloud Module/Tests/SetupOrg.ps1 @@ -81,6 +81,7 @@ Try SystemWindows = Get-JCSystem -displayName:($PesterParams_SystemNameWindows) CommandResults = Get-JCCommandResult } + $PesterParamsHash_Associations = @{ PolicySystemGroupMembership = $PesterParamsHash_BuildOrg.MultiplePolicy | ForEach-Object { If (-not (Get-JCAssociation -Type:('policy') -Id:($_.id) -TargetType:('system_group') | Where-Object { $_.targetId -eq $PesterParamsHash_BuildOrg.SystemGroup.id })) { New-JCAssociation -Type:('policy') -Id:($_.id) -TargetType:('system_group') -TargetId:($PesterParamsHash_BuildOrg.SystemGroup.id) -force; }; @@ -92,7 +93,7 @@ Try Command2SystemGroupMembership = If (-not (Get-JCAssociation -Type:('command') -Id:($PesterParamsHash_BuildOrg.Command2._id) -TargetType:('system_group') | Where-Object { $_.targetId -eq $PesterParamsHash_BuildOrg.SystemGroup.id })) { New-JCAssociation -Type:('command') -Id:($PesterParamsHash_BuildOrg.Command2._id) -TargetType:('system_group') -TargetId:($PesterParamsHash_BuildOrg.SystemGroup.id) -force; }; Command3SystemGroupMembership = If (-not (Get-JCAssociation -Type:('command') -Id:($PesterParamsHash_BuildOrg.Command3._id) -TargetType:('system_group') | Where-Object { $_.targetId -eq $PesterParamsHash_BuildOrg.SystemGroup.id })) { New-JCAssociation -Type:('command') -Id:($PesterParamsHash_BuildOrg.Command3._id) -TargetType:('system_group') -TargetId:($PesterParamsHash_BuildOrg.SystemGroup.id) -force; }; } - # Generate command results of they dont exist + # Generate command results if they dont exist If ([System.String]::IsNullOrEmpty($PesterParamsHash_BuildOrg.CommandResults) -or $PesterParamsHash_BuildOrg.CommandResults.Count -lt $PesterParams_CommandResultCount) { If (-not (Get-JCAssociation -Type:('command') -Id:($PesterParamsHash_BuildOrg.Command1._id) -TargetType:('system') | Where-Object { $_.targetId -eq $PesterParamsHash_BuildOrg.SystemLinux._id })) @@ -121,5 +122,9 @@ Try } Catch { - Write-Error ($_) + Write-Error ($_.Exception) + Write-Error ($_.FullyQualifiedErrorId) + Write-Error ($_.ScriptStackTrace) + Write-Error ($_.TargetObject) + Write-Error ($_.PSMessageDetails) } diff --git a/PowerShell/JumpCloud Module/en-Us/JumpCloud-help.xml b/PowerShell/JumpCloud Module/en-Us/JumpCloud-help.xml index aa1b7d689..d831da67d 100644 --- a/PowerShell/JumpCloud Module/en-Us/JumpCloud-help.xml +++ b/PowerShell/JumpCloud Module/en-Us/JumpCloud-help.xml @@ -4050,9 +4050,9 @@ PS C:\> $BackupJcOrganizationResults.User Specific query to search after, see x-* response headers for next values - System.String[] + JumpCloud.SDK.DirectoryInsights.Models.IEventQuerySearchAfterItem[] - System.String[] + JumpCloud.SDK.DirectoryInsights.Models.IEventQuerySearchAfterItem[] None @@ -4183,9 +4183,9 @@ PS C:\> $BackupJcOrganizationResults.User Specific query to search after, see x-* response headers for next values - System.String[] + JumpCloud.SDK.DirectoryInsights.Models.IEventQuerySearchAfterItem[] - System.String[] + JumpCloud.SDK.DirectoryInsights.Models.IEventQuerySearchAfterItem[] None @@ -4294,14 +4294,6 @@ PS C:\> $BackupJcOrganizationResults.User - - - System.String - - - - - @@ -4455,9 +4447,9 @@ PS C:\> $BackupJcOrganizationResults.User Specific query to search after, see x-* response headers for next values - System.String[] + JumpCloud.SDK.DirectoryInsights.Models.IEventQuerySearchAfterItem[] - System.String[] + JumpCloud.SDK.DirectoryInsights.Models.IEventQuerySearchAfterItem[] None @@ -4588,9 +4580,9 @@ PS C:\> $BackupJcOrganizationResults.User Specific query to search after, see x-* response headers for next values - System.String[] + JumpCloud.SDK.DirectoryInsights.Models.IEventQuerySearchAfterItem[] - System.String[] + JumpCloud.SDK.DirectoryInsights.Models.IEventQuerySearchAfterItem[] None @@ -4699,14 +4691,6 @@ PS C:\> $BackupJcOrganizationResults.User - - - System.String - - - - - @@ -9199,6 +9183,12 @@ SystemID CommandID Status The New-JCDeploymentTemplate command is a menu driven interactive function that guides admins through the process of creating a command deployment CSV file and assists in gathering the required information needed to populate the command deployment CSV file. + Note: Windows commands and Mac/Linux commands interpret variables differently. Windows commands with variables you wish to replace during Invoke-JCDeployment should be written as `${ENV:$variableToReplace}` within the command body. The header variables of Windows Command Deployment CSVs should be prefixed with `$` + Example valid Windows PowerShell command: `Invoke-WebRequest -Uri $url -OutFile ${ENV:$UserPath}\${ENV:$FileName}` + Example Valid Mac/Linux CSV: | "SystemID" | "$UserPath" | "$FileName" | |-------------------------- |------------------------- |----------------------- | | 602c4806e87bc117c434fb71 | "C:\Users\Joe\Desktop" | "PDF_JoeToSign.pdf" | | 60623c9d0bab5a18614d4d6d | "C:\Users\Bob\Desktop" | "PDF_BobToSign.pdf" | | 6025b5aa115b9917f6903436 | "C:\Users\Steve\Desktop" | "PDF_SteveToSign.pdf" | + Mac and Linux commands work similarly in the sense that command body variables such as `$variableToReplace` will be replaced when running Invoke-JCDeployment. The header variables of a Mac/Linux Command Deployment CSV do not need to be prefixed with `$` + Example valid Mac/Linux command: `curl -L -o $UserPath/$FileName $url >/dev/null` + Example Valid Mac/Linux CSV: | "SystemID" | "UserPath" | "FileName" | |-------------------------- |------------------------- |----------------------- | | 602c4806e87bc117c434fb71 | "/Users/Joe/Desktop" | "PDF_JoeToSign.pdf" | | 60623c9d0bab5a18614d4d6d | "/Users/Bob/Desktop" | "PDF_BobToSign.pdf" | | 6025b5aa115b9917f6903436 | "/Users/Steve/Desktop" | "PDF_SteveToSign.pdf" | diff --git a/PowerShell/ModuleBanner.md b/PowerShell/ModuleBanner.md index e251b80a6..221b450f3 100755 --- a/PowerShell/ModuleBanner.md +++ b/PowerShell/ModuleBanner.md @@ -1,7 +1,7 @@ #### Latest Version ``` -1.18.3 +1.18.4 ``` #### Banner Current diff --git a/PowerShell/ModuleChangelog.md b/PowerShell/ModuleChangelog.md index 6448808fd..33f20f6de 100644 --- a/PowerShell/ModuleChangelog.md +++ b/PowerShell/ModuleChangelog.md @@ -1,3 +1,19 @@ +## 1.18.4 + +Release Date: May 03, 2021 + +#### RELEASE NOTES + +* Invoke-JCDeployment updated to use SDK versions of the PowerShell Module + +#### FEATURES + +#### IMPROVEMENTS + +#### BUG FIXES + +* Invoke-JCDeployment will no longer reset a command type to linux when run + ## 1.18.3 Release Date: January 04, 2021