diff --git a/.github/workflows/powershell-module-ci.yml b/.github/workflows/powershell-module-ci.yml index 7734f2702..81fe8989c 100644 --- a/.github/workflows/powershell-module-ci.yml +++ b/.github/workflows/powershell-module-ci.yml @@ -64,7 +64,7 @@ jobs: run: | # validate release type variables $env:RELEASE_TYPE | Should -BeIn @('major','minor','patch','manual') - Setup-Build-Dependancies: + Setup-Build-Dependencies: needs: ["Filter-Branch", "Check-PR-Labels", "Validate-Env-Variables"] runs-on: ubuntu-latest timeout-minutes: 10 @@ -75,7 +75,7 @@ jobs: uses: actions/cache@v3 with: path: "/home/runner/.local/share/powershell/Modules/" - key: PS-Dependancies + key: PS-Dependencies - name: Install dependencies if: steps.cacher.outputs.cache-hit != 'true' shell: pwsh @@ -98,9 +98,9 @@ jobs: 'PlatyPS' = @{Repository = 'PSGallery'; RequiredVersion = '0.14.2' } 'AWS.Tools.Common' = @{Repository = 'PSGallery'; RequiredVersion = '4.1.122' } 'AWS.Tools.CodeArtifact' = @{Repository = 'PSGallery'; RequiredVersion = '4.1.122' } - 'JumpCloud.SDK.V1' = @{Repository = 'PSGallery'; RequiredVersion = 'latest'} - 'JumpCloud.SDK.V2' = @{Repository = 'PSGallery'; RequiredVersion = 'latest'} - 'JumpCloud.SDK.DirectoryInsights' = @{Repository = 'PSGallery'; RequiredVersion = 'latest'} + 'JumpCloud.SDK.V1' = @{Repository = 'PSGallery'; RequiredVersion = '0.1.1'} + 'JumpCloud.SDK.V2' = @{Repository = 'PSGallery'; RequiredVersion = '0.1.1'} + 'JumpCloud.SDK.DirectoryInsights' = @{Repository = 'PSGallery'; RequiredVersion = '0.1.1'} 'powershell-yaml' = @{Repository = 'PSGallery'; RequiredVersion = '0.4.7'} } @@ -116,7 +116,7 @@ jobs: } Validate-Module: - needs: ["Setup-Build-Dependancies", "Check-PR-Labels"] + needs: ["Setup-Build-Dependencies", "Check-PR-Labels"] runs-on: ubuntu-latest timeout-minutes: 10 steps: @@ -128,14 +128,14 @@ jobs: - uses: actions/cache@v3 with: path: "/home/runner/.local/share/powershell/Modules/" - key: PS-Dependancies + key: PS-Dependencies - env: RELEASE_TYPE: ${{ needs.Check-PR-Labels.outputs.RELEASE_TYPE }} shell: pwsh run: | . "./PowerShell/JumpCloud Module/Tests/InvokePester.ps1" -ModuleValidation Setup-Org: - needs: ["Setup-Build-Dependancies", "Check-PR-Labels"] + needs: ["Setup-Build-Dependencies", "Check-PR-Labels"] runs-on: ubuntu-latest name: Setup Org Upload Variable Artifact steps: @@ -147,7 +147,7 @@ jobs: - uses: actions/cache@v3 with: path: "/home/runner/.local/share/powershell/Modules/" - key: PS-Dependancies + key: PS-Dependencies - name: Setup Org Variables shell: pwsh env: @@ -167,7 +167,7 @@ jobs: name: jumpcloud-vars path: /home/runner/.local/share/powershell/Modules/PesterVariables.json Test-Module: - needs: ["Setup-Build-Dependancies", "Check-PR-Labels", "Setup-Org"] + needs: ["Setup-Build-Dependencies", "Check-PR-Labels", "Setup-Org"] runs-on: ubuntu-latest timeout-minutes: 75 strategy: @@ -184,7 +184,7 @@ jobs: - uses: actions/cache@v3 with: path: "/home/runner/.local/share/powershell/Modules/" - key: PS-Dependancies + key: PS-Dependencies - uses: actions/download-artifact@v4 with: name: jumpcloud-vars @@ -194,6 +194,8 @@ jobs: PESTER_APIKEY: ${{ secrets.PESTER_APIKEY }} PESTER_ORGID: ${{ secrets.PESTER_ORGID }} PESTER_MSP_APIKEY: ${{ secrets.PESTER_MSP_APIKEY }} + PESTER_EU_APIKEY: ${{ secrets.PESTER_EU_APIKEY }} + PESTER_EU_ORGID: ${{ secrets.PESTER_EU_ORGID }} run: | # Setup Variables for Pester Run $env:job_group = ${{ matrix.job_group }} @@ -206,7 +208,8 @@ jobs: } } Set-Variable -Name PesterParams_ApiKey -Value "$env:PESTER_APIKEY" -Scope Global - + Set-Variable -Name PesterParams_EU_ApiKey -Value "$env:PESTER_EU_APIKEY" -Scope Global + Set-Variable -Name PesterParams_EU_OrgID -Value "$env:PESTER_EU_ORGID" -Scope Global # Import JC Module Import-Module "${{github.workspace}}/PowerShell/JumpCloud Module/JumpCloud.psd1" @@ -216,7 +219,7 @@ jobs: # Invoke Pester . "./PowerShell/JumpCloud Module/Tests/InvokePester.ps1" -JumpCloudApiKey "$env:PESTER_APIKEY" -ExcludeTagList "ModuleValidation", "JCDeployment", "MSP", "JCModule" -IncludeTagList "*" -RequiredModulesRepo "PSGallery" Test-Module-MSP: - needs: ["Setup-Build-Dependancies", "Check-PR-Labels"] + needs: ["Setup-Build-Dependencies", "Check-PR-Labels"] runs-on: ubuntu-latest timeout-minutes: 20 steps: @@ -228,7 +231,7 @@ jobs: - uses: actions/cache@v3 with: path: "/home/runner/.local/share/powershell/Modules/" - key: PS-Dependancies + key: PS-Dependencies - shell: pwsh env: PESTER_APIKEY: ${{ secrets.PESTER_APIKEY }} diff --git a/.vscode/settings.json b/.vscode/settings.json index d271761b6..2fa14a416 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,12 +1,12 @@ { "cSpell.language": "en", "cSpell.enabled": true, - "cSpell.enableFiletypes": [ - "latex", - "markdown", - "plaintext", - "powershell" - ], + "cSpell.enabledFileTypes": { + "latex": true, + "markdown": true, + "plaintext": true, + "powershell": true + }, // todo highlight settings: "todohighlight.isEnable": true, "todohighlight.isCaseSensitive": true, @@ -65,7 +65,25 @@ "editor.formatOnSave": true, "files.trimTrailingWhitespace": true, // powershell settings - "powershell.codeFormatting.preset": "OTBS", + "powershell.codeFormatting.addWhitespaceAroundPipe": true, + "powershell.codeFormatting.alignPropertyValuePairs": true, + "powershell.codeFormatting.autoCorrectAliases": true, + "powershell.codeFormatting.avoidSemicolonsAsLineTerminators": false, + "powershell.codeFormatting.ignoreOneLineBlock": true, + "powershell.codeFormatting.newLineAfterCloseBrace": true, + "powershell.codeFormatting.newLineAfterOpenBrace": true, + "powershell.codeFormatting.openBraceOnSameLine": true, + "powershell.codeFormatting.pipelineIndentationStyle": "IncreaseIndentationForFirstPipeline", + "powershell.codeFormatting.preset": "OTBS", + "powershell.codeFormatting.trimWhitespaceAroundPipe": true, + "powershell.codeFormatting.useConstantStrings": false, + "powershell.codeFormatting.useCorrectCasing": true, + "powershell.codeFormatting.whitespaceAfterSeparator": true, + "powershell.codeFormatting.whitespaceAroundOperator": true, + "powershell.codeFormatting.whitespaceBeforeOpenBrace": true, + "powershell.codeFormatting.whitespaceBeforeOpenParen": true, + "powershell.codeFormatting.whitespaceBetweenParameters": true, + "powershell.codeFormatting.whitespaceInsideBrace": true, "powershell.scriptAnalysis.enable": true, "powershell.scriptAnalysis.settingsPath": "PowerShell/JumpCloud Module/Tests/ModuleValidation/PSScriptAnalyzerSettings.psd1", } \ No newline at end of file diff --git a/PowerShell/Deploy/Build-HelpFiles.ps1 b/PowerShell/Deploy/Build-HelpFiles.ps1 index 2413e09c0..932810537 100755 --- a/PowerShell/Deploy/Build-HelpFiles.ps1 +++ b/PowerShell/Deploy/Build-HelpFiles.ps1 @@ -1,4 +1,4 @@ -Param( +param( [Parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true, HelpMessage = 'Name of module')][ValidateNotNullOrEmpty()][System.String]$ModuleName = 'JumpCloud' , [Parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true, HelpMessage = 'Path to module root')][ValidateNotNullOrEmpty()][System.String]$ModulePath = './PowerShell/JumpCloud Module' # $PSScriptRoot , [Parameter(Mandatory = $false, ValueFromPipelineByPropertyName = $true, HelpMessage = 'Which parameter set to be used for New-MarkdownHelp')][ValidateNotNullOrEmpty()][ValidateSet('FromCommand', 'FromModule')][System.String]$NewMarkdownHelpParamSet = 'FromCommand' @@ -61,7 +61,7 @@ $FolderPath_Docs = "$ModulePath/Docs" $FolderPath_enUS = "$ModulePath/$Locale" $FilePath_ModulePagePath = "$FolderPath_Docs/$ModuleName.md" Write-Host ("[status]Creating/Updating help files") -Try { +try { Write-Host ("[status]Installing module: PlatyPS") Install-Module -Repository:('PSGallery') -Name:('PlatyPS') -Force # Import module @@ -74,7 +74,7 @@ Try { ######################################################### ############### Adding Comment based help ############### ######################################################### - If ($AddCommentBasedHelp) { + if ($AddCommentBasedHelp) { $FolderPath_Public = "$ModulePath/Public" # Move the help contents from docs files to ps1 files $DocFiles = Get-ChildItem $FolderPath_Docs @@ -88,15 +88,15 @@ Try { $description = ".Description`r`n" + ($help.description.text).Trim() $examples = $help.examples.example | ForEach-Object { $Example = $_ - $ExampleCode = If ($Example.code -like '*C:\>*') { + $ExampleCode = if ($Example.code -like '*C:\>*') { ($Example.code).split(">")[1] - } Else { + } else { $Example.code } (".Example`r`n" + ($ExampleCode).Trim() + "`r`n`r`n" + ($Example.remarks.text).Trim()) } - $notes = If ($help.alertSet.alert.text) { ".Notes`r`n" + ($help.alertSet.alert.text).Trim() } - $link = If ($help.relatedLinks.navigationLink.uri) { ".Link`r`n" + ($help.relatedLinks.navigationLink.uri).Trim() } + $notes = if ($help.alertSet.alert.text) { ".Notes`r`n" + ($help.alertSet.alert.text).Trim() } + $link = if ($help.relatedLinks.navigationLink.uri) { ".Link`r`n" + ($help.relatedLinks.navigationLink.uri).Trim() } Set-Content $file.FullName -Value "<#", $synopsis, $description, $examples, $notes, $link, "#>" Add-Content $file.FullName -Value $content } @@ -110,16 +110,16 @@ Try { ######################################################### ######################################################### # If not exist create: .\Docs\about_$ModuleName.md - If (-not (Test-Path -Path:("$($FolderPath_Docs)/about_$($ModuleName).md"))) { + if (-not (Test-Path -Path:("$($FolderPath_Docs)/about_$($ModuleName).md"))) { Write-Host ("[status]Creating New-MarkdownAboutHelp") New-MarkdownAboutHelp -OutputFolder:($FolderPath_Docs) -AboutName:($ModuleName) } # Creating help files: .\Docs\*.md Write-Host ("[status]Creating help files: .\Docs\*.md") - Switch ($NewMarkdownHelpParamSet) { + switch ($NewMarkdownHelpParamSet) { 'FromCommand' { $Psd1.FunctionsToExport | ForEach-Object { - If (-not (Test-Path -Path:("$($FolderPath_Docs)/$($_).md"))) { + if (-not (Test-Path -Path:("$($FolderPath_Docs)/$($_).md"))) { $parameters = @{ Command = $_ Force = $true @@ -133,6 +133,7 @@ Try { # Session = '' # Metadata = '' } + Write-Host ("[status]Creating help file for command: $($_)") New-MarkdownHelp @parameters } } @@ -155,9 +156,10 @@ Try { # Session = '' # Metadata = '' } + Write-Host ("[status]Creating help file for command: $($_)") New-MarkdownHelp @parameters } - Default { + default { Write-Error ("Unknown `$NewMarkdownHelpParamSet value: $NewMarkdownHelpParamSet") } } @@ -171,13 +173,15 @@ Try { UpdateInputOutput = $true Force = $true ExcludeDontShow = $true - # LogPath = "$FolderPath_Docs\PlatyPS.log" - # LogAppend = $true + LogPath = "$FolderPath_Docs\PlatyPS.log" + LogAppend = $true # Encoding = '' # Session = '' } + Write-Host ("[status]Updating help files: .\Docs\*.md") Update-MarkdownHelpModule @parameters # Manually updating specific feilds within JumpCloud.md + Write-Host ("[status]Updating JumpCloud.md") $ModulePageContent = Get-Content -Path:($FilePath_ModulePagePath) -Raw $ModulePageContent = $ModulePageContent.Replace("`r", '') $ModulePageContent = $ModulePageContent.Replace("## Description`n{{ Fill in the Description }}", "## Description`n$($Psd1.Description)") @@ -223,7 +227,7 @@ Try { (Get-Content -Path "$FolderPath_enUS/$ModuleName-help.xml" -Raw).Replace($ProgressActionXML1, '') | Set-Content "$FolderPath_enUS/$ModuleName-help.xml" (Get-Content -Path "$FolderPath_enUS/$ModuleName-help.xml" -Raw).Replace($ProgressActionXML2, '') | Set-Content "$FolderPath_enUS/$ModuleName-help.xml" -} Catch { +} catch { Write-Error ($_) } diff --git a/PowerShell/Deploy/SdkSync/jcapiToSupportSync.ps1 b/PowerShell/Deploy/SdkSync/jcapiToSupportSync.ps1 index b1184744d..7c77bb49b 100644 --- a/PowerShell/Deploy/SdkSync/jcapiToSupportSync.ps1 +++ b/PowerShell/Deploy/SdkSync/jcapiToSupportSync.ps1 @@ -113,10 +113,10 @@ $PSD1_Module = Test-ModuleManifest -Path:("$FilePath_psd1") Get-Module -Refresh -ListAvailable -All | Out-Null $Modules = Get-Module -Name:($Psd1.RequiredModules | Where-Object { $_ -in $ApprovedFunctions.Keys }) -If (-not [System.String]::IsNullOrEmpty($Modules)) { - ForEach ($Module In $Modules) { +if (-not [System.String]::IsNullOrEmpty($Modules)) { + foreach ($Module in $Modules) { $ModuleName = $Module.Name - ForEach ($Function In $ApprovedFunctions.$ModuleName) { + foreach ($Function in $ApprovedFunctions.$ModuleName) { $FunctionName = $Function.Name $FunctionDestination = $Function.Destination $OutputPath = Join-Path -Path $JumpCloudModulePath -ChildPath $FunctionDestination #"$JumpCloudModulePath/$FunctionDestination" @@ -128,7 +128,7 @@ If (-not [System.String]::IsNullOrEmpty($Modules)) { # Get content from sdk function $CommandFilePath = $individualCommand.ScriptBlock.File $CommandFilePathContent = Get-Content -Path:($CommandFilePath) -Raw - $FunctionContent = If ($CommandFilePath -like '*ProxyCmdletDefinitions.ps1') { + $FunctionContent = if ($CommandFilePath -like '*ProxyCmdletDefinitions.ps1') { <# When the autorest generated module has been installed and imported from the PSGallery all the cmdlets will exist in a single ProxyCmdletDefinitions.ps1 file. We need to parse out the specific function in order to gather the parts we need to copy over. #> @@ -140,7 +140,7 @@ If (-not [System.String]::IsNullOrEmpty($Modules)) { $functionSplit } } - } Else { + } else { <# When the autorest generated module has been imported from a local psd1 module the function will remain in their individual files. #> $CommandFilePathContent @@ -148,7 +148,7 @@ If (-not [System.String]::IsNullOrEmpty($Modules)) { # Extract the sections we want to copy over to our new function. $PSScriptInfo = ($FunctionContent | Select-String -Pattern:([regex]'(?s)(<#)(.*?)(#>)')).Matches.Value $Params = $FunctionContent | Select-String -Pattern:([regex]'(?s)( \[Parameter)(.*?)(\})') -AllMatches - $ParameterContent = ($Params.Matches.Value | Where-Object { $_ -notlike '*DontShow*' -and $_ -notlike '${Limit}' -and $_ -notlike '*${Skip}*' }) + $ParameterContent = ($Params.Matches.Value | Where-Object { $_ -notlike '*DontShow*' -and $_ -notlike '${Limit}' -and $_ -notlike '*${Skip}*' -and $_ -notlike '*${apiHost}*' -and $_ -notlike '*${consoleHost}*' }) # Check if there is only one parameter if ($ParameterContent -is [string]) { @@ -166,7 +166,7 @@ If (-not [System.String]::IsNullOrEmpty($Modules)) { # declare param here string $paramString = @" "@ - ForEach ($line in $($ParameterContent -split "`n")) { + foreach ($line in $($ParameterContent -split "`n")) { # for the last item don't add a new line: if ($line -eq $($ParameterContent -split "`n")[-1] ) { $line = $line -replace '(^\s+|\s+$)', '' @@ -183,7 +183,7 @@ If (-not [System.String]::IsNullOrEmpty($Modules)) { } $OutputType = (($FunctionContent | Select-String -Pattern:([regex]'(\[OutputType)(.*?)(\]\s+)')).Matches.Value).TrimEnd() $CmdletBinding = (($FunctionContent | Select-String -Pattern:([regex]'(\[CmdletBinding)(.*?)(\]\s+)')).Matches.Value).TrimEnd() - If (-not [System.String]::IsNullOrEmpty($PSScriptInfo)) { + if (-not [System.String]::IsNullOrEmpty($PSScriptInfo)) { $PSScriptInfo = $PSScriptInfo.Replace($SdkPrefix, $JumpCloudModulePrefix) $PSScriptInfo = $PSScriptInfo.Replace("$NewCommandName.md", "$FunctionName.md") } @@ -226,14 +226,14 @@ $paramString $NewScript | Out-File -FilePath:($OutputFilePath) -Force # Validate script syntax $ScriptAnalyzerResult = Invoke-ScriptAnalyzer -Path:($OutputFilePath) -Recurse -ExcludeRule PSShouldProcess, PSAvoidTrailingWhitespace, PSAvoidUsingWMICmdlet, PSAvoidUsingPlainTextForPassword, PSAvoidUsingUsernameAndPasswordParams, PSAvoidUsingInvokeExpression, PSUseDeclaredVarsMoreThanAssignments, PSUseSingularNouns, PSAvoidGlobalVars, PSUseShouldProcessForStateChangingFunctions, PSAvoidUsingWriteHost, PSAvoidUsingPositionalParameters - If ($ScriptAnalyzerResult) { + if ($ScriptAnalyzerResult) { $ScriptAnalyzerResults += $ScriptAnalyzerResult } # Copy tests? # Copy-Item -Path:($AutoRest_Tests) -Destination:($JCModule_Tests) -Force # Update .Psd1 file - If ($NewCommandName -notin $PSD1_Module.ExportedFunctions.keys) { + if ($NewCommandName -notin $PSD1_Module.ExportedFunctions.keys) { $Psd1.FunctionsToExport += $NewCommandName Update-ModuleManifest -Path:($FilePath_psd1) -FunctionsToExport:($Psd1.FunctionsToExport) } @@ -241,6 +241,6 @@ $paramString } } } -} Else { +} else { Write-Error ('No modules found!') } \ No newline at end of file diff --git a/PowerShell/JumpCloud Module/.gitignore b/PowerShell/JumpCloud Module/.gitignore index 9fa923fdf..80e214b31 100644 --- a/PowerShell/JumpCloud Module/.gitignore +++ b/PowerShell/JumpCloud Module/.gitignore @@ -1 +1,2 @@ -Tests/*-TestResults.xml \ No newline at end of file +Tests/*-TestResults.xml +PlatyPS.log \ No newline at end of file diff --git a/PowerShell/JumpCloud Module/Docs/Connect-JCOnline.md b/PowerShell/JumpCloud Module/Docs/Connect-JCOnline.md index 939c52a85..d46559775 100644 --- a/PowerShell/JumpCloud Module/Docs/Connect-JCOnline.md +++ b/PowerShell/JumpCloud Module/Docs/Connect-JCOnline.md @@ -70,7 +70,7 @@ Specific to JumpCloud development team to connect to staging dev environment. Type: System.String Parameter Sets: (All) Aliases: -Accepted values: production, staging +Accepted values: STANDARD, staging, EU Required: False Position: 3 diff --git a/PowerShell/JumpCloud Module/Docs/Get-JCCommand.md b/PowerShell/JumpCloud Module/Docs/Get-JCCommand.md index 1c27edb84..516038b30 100644 --- a/PowerShell/JumpCloud Module/Docs/Get-JCCommand.md +++ b/PowerShell/JumpCloud Module/Docs/Get-JCCommand.md @@ -188,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, launchType, commandType, trigger, scheduleRepeatType, listensTo, organization, commandRunners, schedule, shell, timeout, sudo, template, scheduleYear, timeToLiveSeconds, files, user, systems, description, filesS3 +Accepted values: aiGenerated, command, name, launchType, commandType, trigger, scheduleRepeatType, listensTo, organization, commandRunners, schedule, shell, timeout, sudo, template, scheduleYear, timeToLiveSeconds, files, user, systems, description, filesS3 Required: False Position: Named diff --git a/PowerShell/JumpCloud Module/Docs/Get-JCEvent.md b/PowerShell/JumpCloud Module/Docs/Get-JCEvent.md index 71fe2c16d..2ed87417c 100644 --- a/PowerShell/JumpCloud Module/Docs/Get-JCEvent.md +++ b/PowerShell/JumpCloud Module/Docs/Get-JCEvent.md @@ -14,8 +14,8 @@ Query the API for Directory Insights events ### GetExpanded (Default) ``` -Get-JCEvent -Service -StartTime [-EndTime ] [-Fields ] - [-Limit ] [-Q ] [-SearchAfter ] [-SearchTermAnd ] +Get-JCEvent -Service -StartTime [-EndTime ] [-ExactMatch ] + [-Fields ] [-Limit ] [-Q ] [-SearchAfter ] [-SearchTermAnd ] [-SearchTermNot ] [-SearchTermOr ] [-Sort ] [-WhatIf] [-Confirm] [] ``` @@ -119,6 +119,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -ExactMatch +optional string for specifying exact match query, do not use with full text query + +```yaml +Type: System.String +Parameter Sets: GetExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -Fields optional list of fields to return from query diff --git a/PowerShell/JumpCloud Module/Docs/Get-JCEventCount.md b/PowerShell/JumpCloud Module/Docs/Get-JCEventCount.md index 5cdeb0ece..9dceede2e 100644 --- a/PowerShell/JumpCloud Module/Docs/Get-JCEventCount.md +++ b/PowerShell/JumpCloud Module/Docs/Get-JCEventCount.md @@ -14,10 +14,10 @@ Query the API for a count of matching events ### GetExpanded (Default) ``` -Get-JCEventCount -Service -StartTime [-EndTime ] [-Fields ] - [-Q ] [-SearchAfter ] [-SearchTermAnd ] [-SearchTermNot ] - [-SearchTermOr ] [-Sort ] [-WhatIf] [-Confirm] - [] +Get-JCEventCount -Service -StartTime [-EndTime ] [-ExactMatch ] + [-Fields ] [-Q ] [-SearchAfter ] [-SearchTermAnd ] + [-SearchTermNot ] [-SearchTermOr ] [-Sort ] + [-WhatIf] [-Confirm] [] ``` ### Get @@ -92,6 +92,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -ExactMatch +optional string for specifying exact match query, do not use with full text query + +```yaml +Type: System.String +Parameter Sets: GetExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -Fields optional list of fields to return from query @@ -267,7 +282,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ### JumpCloud.SDK.DirectoryInsights.Models.IEventQuery ## OUTPUTS -### System.Int64 +### JumpCloud.SDK.DirectoryInsights.Models.IEventCount ## NOTES COMPLEX PARAMETER PROPERTIES diff --git a/PowerShell/JumpCloud Module/Docs/Get-JCReport.md b/PowerShell/JumpCloud Module/Docs/Get-JCReport.md index a3bad536c..01c7466bf 100644 --- a/PowerShell/JumpCloud Module/Docs/Get-JCReport.md +++ b/PowerShell/JumpCloud Module/Docs/Get-JCReport.md @@ -14,12 +14,12 @@ Ordered list of report metadata ### List (Default) ``` -Get-JCReport [-Sort ] [] +Get-JCReport [-Sort ] [] ``` ### Report ``` -Get-JCReport [-Sort ] -ReportID -Type +Get-JCReport [-Sort ] -ReportID -Type [] ``` @@ -80,7 +80,7 @@ Sort type and direction. Default sort is descending, prefix with - to sort ascending. ```yaml -Type: JumpCloud.SDK.DirectoryInsights.Support.Sort +Type: System.Object Parameter Sets: (All) Aliases: diff --git a/PowerShell/JumpCloud Module/Docs/Get-JCSystem.md b/PowerShell/JumpCloud Module/Docs/Get-JCSystem.md index 0a7c96579..ab70354b0 100644 --- a/PowerShell/JumpCloud Module/Docs/Get-JCSystem.md +++ b/PowerShell/JumpCloud Module/Docs/Get-JCSystem.md @@ -357,7 +357,7 @@ Valid properties that can be returned are: 'created', 'active', 'agentVersion', Type: System.String[] Parameter Sets: SearchFilter Aliases: -Accepted values: acknowledged, active, agentVersion, allowMultiFactorAuthentication, allowPublicKeyAuthentication, allowSshPasswordAuthentication, allowSshRootLogin, arch, azureAdJoined, connectionHistory, created, displayName, domainInfo, fde, fileSystem, hasServiceAccount, hostname, lastContact, mdm, modifySSHDConfig, networkInterfaces, organization, os, osFamily, primarySystemUser, provisionMetadata, remoteAssistAgentVersion, remoteIP, serialNumber, serviceAccountState, sshdParams, systemInsights, systemTimezone, templateName, userMetrics, usernameHashes, version, hwVendor, secureLogin, displayManager, amazonInstanceID, archFamily, builtInCommands, description, osVersionDetail, policyStats, desktopCapable, sshRootEnabled, isPolicyBound, agentHasFullDiskAccess +Accepted values: acknowledged, active, agentVersion, allowMultiFactorAuthentication, allowPublicKeyAuthentication, allowSshPasswordAuthentication, allowSshRootLogin, arch, attributes, azureAdJoined, connectionHistory, created, displayName, domainInfo, fde, fileSystem, hasServiceAccount, hostname, lastContact, mdm, modifySSHDConfig, networkInterfaces, organization, os, osFamily, primarySystemUser, provisionMetadata, remoteAssistAgentVersion, remoteIP, serialNumber, serviceAccountState, sshdParams, systemInsights, systemTimezone, templateName, userMetrics, usernameHashes, version, hwVendor, secureLogin, displayManager, amazonInstanceID, archFamily, builtInCommands, description, osVersionDetail, policyStats, desktopCapable, sshRootEnabled, isPolicyBound, agentHasFullDiskAccess Required: False Position: Named diff --git a/PowerShell/JumpCloud Module/Docs/JumpCloud.md b/PowerShell/JumpCloud Module/Docs/JumpCloud.md index 9c16945f0..977420f2d 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: 2.18.2 +Help Version: 3.0.0 Locale: en-Us --- diff --git a/PowerShell/JumpCloud Module/Docs/New-JCReport.md b/PowerShell/JumpCloud Module/Docs/New-JCReport.md index 2533a570c..6de6815bf 100644 --- a/PowerShell/JumpCloud Module/Docs/New-JCReport.md +++ b/PowerShell/JumpCloud Module/Docs/New-JCReport.md @@ -14,7 +14,7 @@ Request a JumpCloud report to be generated asynchronously ### Create (Default) ``` -New-JCReport -ReportType [-WhatIf] [-Confirm] +New-JCReport -ReportType [-WhatIf] [-Confirm] [] ``` @@ -65,7 +65,7 @@ Accept wildcard characters: False Report Type ```yaml -Type: JumpCloud.SDK.DirectoryInsights.Support.ReportType1 +Type: System.Object Parameter Sets: Create Aliases: diff --git a/PowerShell/JumpCloud Module/Docs/PlatyPS.log b/PowerShell/JumpCloud Module/Docs/PlatyPS.log deleted file mode 100644 index 7d75bf7e7..000000000 --- a/PowerShell/JumpCloud Module/Docs/PlatyPS.log +++ /dev/null @@ -1,1023 +0,0 @@ - -[Update-MarkdownHelpModule] 09/17/2020 09:16:03 Determined module name for 'C:\Users\epanipinto\Documents\GitHub\support\PowerShell\JumpCloud Module/Docs' as 'JumpCloud'. -[Update-MarkdownHelpModule] 09/17/2020 09:16:03 [Update-MarkdownHelpModule]9/17/2020 09:16:03 -[Update-MarkdownHelpModule] 09/17/2020 09:16:03 Updating documents for module 'JumpCloud' in C:\Users\epanipinto\Documents\GitHub\support\PowerShell\JumpCloud Module/Docs ----- UPDATING Cmdlet : Add-JCAssociation ---- - - Parameter Updated: Attributes - Position updated from 12 to - - Parameter Updated: Id - Position updated from 1 to - - Parameter Updated: Name - Position updated from 1 to - - Parameter Updated: TargetId - Position updated from 10 to - - Parameter Updated: TargetName - Position updated from 11 to - - Parameter Updated: TargetType - Position updated from 2 to - - Parameter Updated: Type - Position updated from 0 to 1 - ----- COMPLETED UPDATING Cmdlet : Add-JCAssociation ---- - - ----- UPDATING Cmdlet : Add-JCCommandTarget ---- - - Parameter Updated: CommandID - Position updated from 0 to 1 - - Parameter Updated: GroupID - Position updated from 1 to 2 - - Parameter Updated: GroupName - Position updated from 1 to 2 - - Parameter Updated: SystemID - Position updated from 1 to 2 - ----- COMPLETED UPDATING Cmdlet : Add-JCCommandTarget ---- - - ----- UPDATING Cmdlet : Add-JCRadiusReplyAttribute ---- - - Parameter Set Added: ByGroup - - Parameter Set Deleted: - - Parameter Set Name Updated: ByGroup - Old Set: - New Set: ByGroup - - Parameter Updated: Attribute1_name - Position updated from Named to - - Parameter Updated: Attribute1_value - Position updated from Named to - - Parameter Updated: Attribute2_name - Position updated from Named to - - Parameter Updated: Attribute2_value - Position updated from Named to - - Parameter Updated: GroupName - Position updated from 0 to 1 - - Parameter Updated: VLANTag - Position updated from Named to - ----- COMPLETED UPDATING Cmdlet : Add-JCRadiusReplyAttribute ---- - - ----- UPDATING Cmdlet : Add-JCSystemGroupMember ---- - - Parameter Updated: GroupName - Position updated from 0 to 1 - ----- COMPLETED UPDATING Cmdlet : Add-JCSystemGroupMember ---- - - ----- UPDATING Cmdlet : Add-JCSystemUser ---- - - Parameter Updated: Administrator - Position updated from Named to 3 - - Parameter Updated: SystemID - Position updated from Named to 2 - - Parameter Updated: Username - Position updated from 0 to 1 - ----- COMPLETED UPDATING Cmdlet : Add-JCSystemUser ---- - - ----- UPDATING Cmdlet : Add-JCUserGroupMember ---- - - Parameter Updated: GroupName - Position updated from 0 to 1 - - Parameter Updated: Username - Position updated from 1 to 2 - ----- COMPLETED UPDATING Cmdlet : Add-JCUserGroupMember ---- - - ----- UPDATING Cmdlet : Connect-JCOnline ---- - - Parameter Set Added: force - - Parameter Set Deleted: - - Parameter Set Name Updated: force - Old Set: - New Set: force - - Parameter Updated: JCEnvironment - Position updated from 3 to - - Parameter Updated: JumpCloudApiKey - Position updated from 1 to - - Parameter Updated: JumpCloudOrgId - Position updated from 2 to - ----- COMPLETED UPDATING Cmdlet : Connect-JCOnline ---- - - ----- UPDATING Cmdlet : Copy-JCAssociation ---- - - Parameter Updated: ExcludeType - Position updated from 15 to - - Parameter Updated: Id - Position updated from 1 to - - Parameter Updated: IncludeType - Position updated from 14 to - - Parameter Updated: Name - Position updated from 1 to - - Parameter Updated: RemoveExisting - Position updated from 13 to - - Parameter Updated: TargetId - Position updated from 10 to - - Parameter Updated: TargetName - Position updated from 11 to - - Parameter Updated: Type - Position updated from 0 to 1 - ----- COMPLETED UPDATING Cmdlet : Copy-JCAssociation ---- - - ----- UPDATING Cmdlet : Get-JCAssociation ---- - - Parameter Set Added: ByValue - - Parameter Set Added: Default - - Parameter Updated: Direct - Position updated from 5 to - - Parameter Updated: Fields - Position updated from 95 to - - Parameter Updated: Id - Position updated from 1 to - - Parameter Updated: IncludeInfo - Position updated from 7 to - - Parameter Updated: IncludeNames - Position updated from 8 to - - Parameter Updated: IncludeVisualPath - Position updated from 9 to - - Parameter Updated: Indirect - Position updated from 6 to - - Parameter Updated: Limit - Position updated from 97 to - - Parameter Updated: Name - Position updated from 1 to - - Parameter Updated: Paginate - Position updated from 99 to - - Parameter Updated: Skip - Position updated from 98 to - - Parameter Updated: TargetType - Position updated from 2 to - - Parameter Updated: Type - Position updated from 0 to 1 - ----- COMPLETED UPDATING Cmdlet : Get-JCAssociation ---- - - ----- UPDATING Cmdlet : Get-JCBackup ---- - - Parameter Set Added: None - - Parameter Set Deleted: - - Parameter Set Name Updated: None - Old Set: - New Set: None - ----- COMPLETED UPDATING Cmdlet : Get-JCBackup ---- - - ----- UPDATING Cmdlet : Get-JCCommand ---- - - Parameter Set Added: ReturnAll - - Parameter Updated: CommandID - Position updated from 0 to 1 - ----- COMPLETED UPDATING Cmdlet : Get-JCCommand ---- - - ----- UPDATING Cmdlet : Get-JCCommandResult ---- - - Parameter Updated: CommandResultID - Position updated from 0 to 1 - ----- COMPLETED UPDATING Cmdlet : Get-JCCommandResult ---- - - ----- UPDATING Cmdlet : Get-JCCommandTarget ---- - - Parameter Set Added: Systems - - Parameter Updated: CommandID - Position updated from 0 to 1 - ----- COMPLETED UPDATING Cmdlet : Get-JCCommandTarget ---- - - ----- UPDATING Cmdlet : Get-JCEvent ---- - - No updates done - ----- COMPLETED UPDATING Cmdlet : Get-JCEvent ---- - - ----- UPDATING Cmdlet : Get-JCEventCount ---- - - No updates done - ----- COMPLETED UPDATING Cmdlet : Get-JCEventCount ---- - - ----- UPDATING Cmdlet : Get-JCGroup ---- - - Parameter Set Added: ReturnAll - - Parameter Updated: Name - Position updated from Named to - - Parameter Updated: Type - Position updated from 0 to 1 - ----- COMPLETED UPDATING Cmdlet : Get-JCGroup ---- - - ----- UPDATING Cmdlet : Get-JCOrganization ---- - - Parameter Set Added: __AllParameterSets - - Parameter Set Deleted: - - Parameter Set Name Updated: __AllParameterSets - Old Set: - New Set: __AllParameterSets - ----- COMPLETED UPDATING Cmdlet : Get-JCOrganization ---- - - ----- UPDATING Cmdlet : Get-JCPolicy ---- - - Parameter Set Added: ReturnAll - - Parameter Updated: PolicyID - Position updated from 0 to 1 - ----- COMPLETED UPDATING Cmdlet : Get-JCPolicy ---- - - ----- UPDATING Cmdlet : Get-JCPolicyResult ---- - - Parameter Updated: PolicyID - Position updated from 0 to 1 - - Parameter Updated: PolicyName - Position updated from 0 to 1 - ----- COMPLETED UPDATING Cmdlet : Get-JCPolicyResult ---- - - ----- UPDATING Cmdlet : Get-JCPolicyTargetGroup ---- - - Parameter Updated: PolicyID - Position updated from 0 to 1 - - Parameter Updated: PolicyName - Position updated from 0 to 1 - ----- COMPLETED UPDATING Cmdlet : Get-JCPolicyTargetGroup ---- - - ----- UPDATING Cmdlet : Get-JCPolicyTargetSystem ---- - - Parameter Updated: PolicyID - Position updated from 0 to 1 - - Parameter Updated: PolicyName - Position updated from 0 to 1 - ----- COMPLETED UPDATING Cmdlet : Get-JCPolicyTargetSystem ---- - - ----- UPDATING Cmdlet : Get-JCRadiusReplyAttribute ---- - - Parameter Set Added: ByGroup - - Parameter Set Deleted: - - Parameter Set Name Updated: ByGroup - Old Set: - New Set: ByGroup - - Parameter Updated: GroupName - Position updated from 0 to 1 - ----- COMPLETED UPDATING Cmdlet : Get-JCRadiusReplyAttribute ---- - - ----- UPDATING Cmdlet : Get-JCRadiusServer ---- - - Parameter Set Added: ByValue - - Parameter Set Added: Default - - Parameter Updated: Fields - Position updated from 95 to - - Parameter Updated: Id - Position updated from 1 to - - Parameter Updated: Limit - Position updated from 97 to - - Parameter Updated: Name - Position updated from 1 to - - Parameter Updated: Paginate - Position updated from 99 to - - Parameter Updated: Skip - Position updated from 98 to - ----- COMPLETED UPDATING Cmdlet : Get-JCRadiusServer ---- - - ----- UPDATING Cmdlet : Get-JCSystem ---- - - Parameter Updated: date - Position updated from Named to - - Parameter Updated: dateFilter - Position updated from Named to - - Parameter Updated: hostname - Position updated from 0 to 1 - ----- COMPLETED UPDATING Cmdlet : Get-JCSystem ---- - - ----- UPDATING Cmdlet : Get-JCSystemGroupMember ---- - - Parameter Updated: GroupName - Position updated from 0 to 1 - ----- COMPLETED UPDATING Cmdlet : Get-JCSystemGroupMember ---- - - ----- UPDATING Cmdlet : Get-JCSystemInsights ---- - - Parameter Set Added: List - - Parameter Set Deleted: - - Parameter Set Name Updated: List - Old Set: - New Set: List - ----- COMPLETED UPDATING Cmdlet : Get-JCSystemInsights ---- - - ----- UPDATING Cmdlet : Get-JCSystemUser ---- - - Parameter Set Added: __AllParameterSets - - Parameter Set Deleted: - - Parameter Set Name Updated: __AllParameterSets - Old Set: - New Set: __AllParameterSets - - Parameter Updated: SystemID - Position updated from 0 to 1 - ----- COMPLETED UPDATING Cmdlet : Get-JCSystemUser ---- - - ----- UPDATING Cmdlet : Get-JCUser ---- - - Parameter Updated: date - Position updated from Named to - - Parameter Updated: dateFilter - Position updated from Named to - - Parameter Updated: username - Position updated from 0 to 1 - ----- COMPLETED UPDATING Cmdlet : Get-JCUser ---- - - ----- UPDATING Cmdlet : Get-JCUserGroupMember ---- - - Parameter Updated: GroupName - Position updated from 0 to 1 - ----- COMPLETED UPDATING Cmdlet : Get-JCUserGroupMember ---- - - ----- UPDATING Cmdlet : Import-JCCommand ---- - - Parameter Set Added: URL - - Parameter Set Deleted: - - Parameter Set Name Updated: URL - Old Set: - New Set: URL - - Parameter Updated: URL - Position updated from 0 to 1 - ----- COMPLETED UPDATING Cmdlet : Import-JCCommand ---- - - ----- UPDATING Cmdlet : Import-JCUsersFromCSV ---- - - Parameter Set Added: GUI - - Parameter Updated: CSVFilePath - Position updated from 0 to 1 - ----- COMPLETED UPDATING Cmdlet : Import-JCUsersFromCSV ---- - - ----- UPDATING Cmdlet : Invoke-JCCommand ---- - - Parameter Set Added: NoVariables - - Parameter Updated: trigger - Position updated from 0 to 1 - - Parameter Updated: Variable1_name - Position updated from Named to - - Parameter Updated: Variable1_value - Position updated from Named to - - Parameter Updated: Variable2_name - Position updated from Named to - - Parameter Updated: Variable2_value - Position updated from Named to - ----- COMPLETED UPDATING Cmdlet : Invoke-JCCommand ---- - - ----- UPDATING Cmdlet : Invoke-JCDeployment ---- - - Parameter Set Added: __AllParameterSets - - Parameter Set Deleted: - - Parameter Set Name Updated: __AllParameterSets - Old Set: - New Set: __AllParameterSets - - Parameter Updated: CommandID - Position updated from 0 to 1 - ----- COMPLETED UPDATING Cmdlet : Invoke-JCDeployment ---- - - ----- UPDATING Cmdlet : New-JCCommand ---- - - Parameter Set Added: __AllParameterSets - - Parameter Set Deleted: - - Parameter Set Name Updated: __AllParameterSets - Old Set: - New Set: __AllParameterSets - - Parameter Updated: command - Position updated from 2 to 3 - - Parameter Updated: commandType - Position updated from 1 to 2 - - Parameter Updated: launchType - Position updated from 3 to 4 - - Parameter Updated: name - Position updated from 0 to 1 - - Parameter Updated: shell - Position updated from Named to - - Parameter Updated: timeout - Position updated from 4 to 5 - - Parameter Updated: trigger - Position updated from Named to - - Parameter Updated: user - Position updated from Named to - ----- COMPLETED UPDATING Cmdlet : New-JCCommand ---- - - ----- UPDATING Cmdlet : New-JCDeploymentTemplate ---- - - Parameter Set Added: __AllParameterSets - - Parameter Set Deleted: - - Parameter Set Name Updated: __AllParameterSets - Old Set: - New Set: __AllParameterSets - ----- COMPLETED UPDATING Cmdlet : New-JCDeploymentTemplate ---- - - ----- UPDATING Cmdlet : New-JCImportTemplate ---- - - Parameter Set Added: __AllParameterSets - - Parameter Set Deleted: - - Parameter Set Name Updated: __AllParameterSets - Old Set: - New Set: __AllParameterSets - ----- COMPLETED UPDATING Cmdlet : New-JCImportTemplate ---- - - ----- UPDATING Cmdlet : New-JCRadiusServer ---- - - Parameter Set Added: ByName - - Parameter Set Deleted: - - Parameter Set Name Updated: ByName - Old Set: - New Set: ByName - - Parameter Updated: Name - Position updated from 1 to - - Parameter Updated: networkSourceIp - Position updated from 4 to - - Parameter Updated: sharedSecret - Position updated from 5 to - ----- COMPLETED UPDATING Cmdlet : New-JCRadiusServer ---- - - ----- UPDATING Cmdlet : New-JCSystemGroup ---- - - Parameter Set Added: __AllParameterSets - - Parameter Set Deleted: - - Parameter Set Name Updated: __AllParameterSets - Old Set: - New Set: __AllParameterSets - - Parameter Updated: GroupName - Position updated from 0 to 1 - ----- COMPLETED UPDATING Cmdlet : New-JCSystemGroup ---- - - ----- UPDATING Cmdlet : New-JCUser ---- - - Parameter Set Added: NoAttributes - - Parameter Updated: Attribute1_name - Position updated from Named to - - Parameter Updated: Attribute1_value - Position updated from Named to - - Parameter Updated: Attribute2_name - Position updated from Named to - - Parameter Updated: Attribute2_value - Position updated from Named to - - Parameter Updated: enrollmentDays - Position updated from Named to - ----- COMPLETED UPDATING Cmdlet : New-JCUser ---- - - ----- UPDATING Cmdlet : New-JCUserGroup ---- - - Parameter Set Added: __AllParameterSets - - Parameter Set Deleted: - - Parameter Set Name Updated: __AllParameterSets - Old Set: - New Set: __AllParameterSets - - Parameter Updated: GroupName - Position updated from 0 to 1 - ----- COMPLETED UPDATING Cmdlet : New-JCUserGroup ---- - - ----- UPDATING Cmdlet : Remove-JCAssociation ---- - - Parameter Updated: Id - Position updated from 1 to - - Parameter Updated: Name - Position updated from 1 to - - Parameter Updated: TargetId - Position updated from 10 to - - Parameter Updated: TargetName - Position updated from 11 to - - Parameter Updated: TargetType - Position updated from 2 to - - Parameter Updated: Type - Position updated from 0 to 1 - ----- COMPLETED UPDATING Cmdlet : Remove-JCAssociation ---- - - ----- UPDATING Cmdlet : Remove-JCCommand ---- - - Parameter Set Added: warn - - Parameter Updated: CommandID - Position updated from 0 to 1 - ----- COMPLETED UPDATING Cmdlet : Remove-JCCommand ---- - - ----- UPDATING Cmdlet : Remove-JCCommandResult ---- - - Parameter Set Added: warn - - Parameter Updated: CommandResultID - Position updated from 0 to 1 - ----- COMPLETED UPDATING Cmdlet : Remove-JCCommandResult ---- - - ----- UPDATING Cmdlet : Remove-JCCommandTarget ---- - - Parameter Updated: CommandID - Position updated from 0 to 1 - - Parameter Updated: GroupID - Position updated from 1 to 2 - - Parameter Updated: GroupName - Position updated from 1 to 2 - - Parameter Updated: SystemID - Position updated from 1 to 2 - ----- COMPLETED UPDATING Cmdlet : Remove-JCCommandTarget ---- - - ----- UPDATING Cmdlet : Remove-JCRadiusReplyAttribute ---- - - Parameter Set Added: ByGroup - - Parameter Set Deleted: - - Parameter Set Name Updated: ByGroup - Old Set: - New Set: ByGroup - - Parameter Updated: GroupName - Position updated from 0 to 1 - ----- COMPLETED UPDATING Cmdlet : Remove-JCRadiusReplyAttribute ---- - - ----- UPDATING Cmdlet : Remove-JCRadiusServer ---- - - Parameter Set Added: ById - - Parameter Set Deleted: - - Parameter Set Name Updated: ById - Old Set: - New Set: ById - - Parameter Updated: Id - Position updated from 1 to - ----- COMPLETED UPDATING Cmdlet : Remove-JCRadiusServer ---- - - ----- UPDATING Cmdlet : Remove-JCSystem ---- - - Parameter Set Added: warn - - Parameter Updated: SystemID - Position updated from 0 to 1 - ----- COMPLETED UPDATING Cmdlet : Remove-JCSystem ---- - - ----- UPDATING Cmdlet : Remove-JCSystemGroup ---- - - Parameter Set Added: warn - - Parameter Updated: GroupName - Position updated from 0 to 1 - ----- COMPLETED UPDATING Cmdlet : Remove-JCSystemGroup ---- - - ----- UPDATING Cmdlet : Remove-JCSystemGroupMember ---- - - Parameter Updated: GroupName - Position updated from 0 to 1 - ----- COMPLETED UPDATING Cmdlet : Remove-JCSystemGroupMember ---- - - ----- UPDATING Cmdlet : Remove-JCSystemUser ---- - - Parameter Updated: SystemID - Position updated from Named to 2 - - Parameter Updated: Username - Position updated from 0 to 1 - ----- COMPLETED UPDATING Cmdlet : Remove-JCSystemUser ---- - - ----- UPDATING Cmdlet : Remove-JCUser ---- - - Parameter Updated: Username - Position updated from 0 to 1 - ----- COMPLETED UPDATING Cmdlet : Remove-JCUser ---- - - ----- UPDATING Cmdlet : Remove-JCUserGroup ---- - - Parameter Set Added: warn - - Parameter Updated: GroupName - Position updated from 0 to 1 - ----- COMPLETED UPDATING Cmdlet : Remove-JCUserGroup ---- - - ----- UPDATING Cmdlet : Remove-JCUserGroupMember ---- - - Parameter Updated: GroupName - Position updated from 0 to 1 - - Parameter Updated: Username - Position updated from 1 to 2 - ----- COMPLETED UPDATING Cmdlet : Remove-JCUserGroupMember ---- - - ----- UPDATING Cmdlet : Send-JCPasswordReset ---- - - Parameter Updated: UserID - Position updated from 0 to 1 - - Parameter Updated: username - Position updated from 0 to 1 - ----- COMPLETED UPDATING Cmdlet : Send-JCPasswordReset ---- - - ----- UPDATING Cmdlet : Set-JCCommand ---- - - Parameter Set Added: __AllParameterSets - - Parameter Set Deleted: - - Parameter Set Name Updated: __AllParameterSets - Old Set: - New Set: __AllParameterSets - - Parameter Updated: command - Position updated from 2 to 3 - - Parameter Updated: CommandID - Position updated from 0 to 1 - - Parameter Updated: launchType - Position updated from 3 to 4 - - Parameter Updated: name - Position updated from 1 to 2 - - Parameter Updated: timeout - Position updated from 4 to 5 - - Parameter Updated: trigger - Position updated from Named to - ----- COMPLETED UPDATING Cmdlet : Set-JCCommand ---- - - ----- UPDATING Cmdlet : Set-JCOrganization ---- - - Parameter Set Added: __AllParameterSets - - Parameter Set Deleted: - - Parameter Set Name Updated: __AllParameterSets - Old Set: - New Set: __AllParameterSets - - Parameter Updated: JumpCloudApiKey - Position updated from 0 to 1 - - Parameter Updated: JumpCloudOrgId - Position updated from 1 to 2 - ----- COMPLETED UPDATING Cmdlet : Set-JCOrganization ---- - - ----- UPDATING Cmdlet : Set-JCRadiusReplyAttribute ---- - - Parameter Set Added: ByGroup - - Parameter Set Deleted: - - Parameter Set Name Updated: ByGroup - Old Set: - New Set: ByGroup - - Parameter Updated: Attribute1_name - Position updated from Named to - - Parameter Updated: Attribute1_value - Position updated from Named to - - Parameter Updated: Attribute2_name - Position updated from Named to - - Parameter Updated: Attribute2_value - Position updated from Named to - - Parameter Updated: GroupName - Position updated from 0 to 1 - - Parameter Updated: VLANTag - Position updated from Named to - ----- COMPLETED UPDATING Cmdlet : Set-JCRadiusReplyAttribute ---- - - ----- UPDATING Cmdlet : Set-JCRadiusServer ---- - - Parameter Set Added: ByValue - - Parameter Updated: Id - Position updated from 1 to - - Parameter Updated: mfa - Position updated from 6 to - - Parameter Updated: Name - Position updated from 1 to - - Parameter Updated: networkSourceIp - Position updated from 4 to - - Parameter Updated: newName - Position updated from 3 to - - Parameter Updated: sharedSecret - Position updated from 5 to - - Parameter Updated: userLockoutAction - Position updated from 7 to - - Parameter Updated: userPasswordExpirationAction - Position updated from 8 to - ----- COMPLETED UPDATING Cmdlet : Set-JCRadiusServer ---- - - ----- UPDATING Cmdlet : Set-JCSystem ---- - - Parameter Set Added: __AllParameterSets - - Parameter Set Deleted: - - Parameter Set Name Updated: __AllParameterSets - Old Set: - New Set: __AllParameterSets - - Parameter Updated: SystemID - Position updated from 0 to 1 - ----- COMPLETED UPDATING Cmdlet : Set-JCSystem ---- - - ----- UPDATING Cmdlet : Set-JCSystemUser ---- - - Parameter Updated: Administrator - Position updated from Named to 3 - - Parameter Updated: SystemID - Position updated from Named to 2 - - Parameter Updated: Username - Position updated from 0 to 1 - ----- COMPLETED UPDATING Cmdlet : Set-JCSystemUser ---- - - ----- UPDATING Cmdlet : Set-JCUser ---- - - Parameter Updated: Attribute1_name - Position updated from Named to - - Parameter Updated: Attribute1_value - Position updated from Named to - - Parameter Updated: Attribute2_name - Position updated from Named to - - Parameter Updated: Attribute2_value - Position updated from Named to - - Parameter Updated: EnrollmentDays - Position updated from Named to - - Parameter Updated: Username - Position updated from 0 to 1 - ----- COMPLETED UPDATING Cmdlet : Set-JCUser ---- - - ----- UPDATING Cmdlet : Set-JCUserGroupLDAP ---- - - Parameter Updated: GroupID - Position updated from 0 to 1 - - Parameter Updated: GroupName - Position updated from 0 to 1 - ----- COMPLETED UPDATING Cmdlet : Set-JCUserGroupLDAP ---- - - ----- UPDATING Cmdlet : Update-JCModule ---- - - Parameter Set Added: __AllParameterSets - - Parameter Set Deleted: - - Parameter Set Name Updated: __AllParameterSets - Old Set: - New Set: __AllParameterSets - ----- COMPLETED UPDATING Cmdlet : Update-JCModule ---- - - ----- UPDATING Cmdlet : Update-JCUsersFromCSV ---- - - Parameter Set Added: GUI - - Parameter Updated: CSVFilePath - Position updated from 0 to 1 - ----- COMPLETED UPDATING Cmdlet : Update-JCUsersFromCSV ---- - - diff --git a/PowerShell/JumpCloud Module/Docs/Set-JCSettingsFile.md b/PowerShell/JumpCloud Module/Docs/Set-JCSettingsFile.md index 1bb2c174f..f0b2b10b4 100644 --- a/PowerShell/JumpCloud Module/Docs/Set-JCSettingsFile.md +++ b/PowerShell/JumpCloud Module/Docs/Set-JCSettingsFile.md @@ -15,7 +15,7 @@ Updates the JumpCloud Module Settings File ``` Set-JCSettingsFile [-parallelOverride ] - [-moduleBannerMessageCount ] [] + [-JCEnvironmentLocation ] [-moduleBannerMessageCount ] [] ``` ## DESCRIPTION @@ -34,6 +34,21 @@ Disables parallel processing of results in the JumpCloud PowerShell Module ## PARAMETERS +### -JCEnvironmentLocation +sets the System.Management.Automation.PSCustomObject Location=@{write=True; copy=True; value=STANDARD} settings for the System.Management.Automation.PSCustomObject JCEnvironment=@{Location=} feature + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -moduleBannerMessageCount sets the messageCount settings for the moduleBanner feature diff --git a/PowerShell/JumpCloud Module/JumpCloud.psd1 b/PowerShell/JumpCloud Module/JumpCloud.psd1 index b52e6eaad..c10fd8d29 100644 --- a/PowerShell/JumpCloud Module/JumpCloud.psd1 +++ b/PowerShell/JumpCloud Module/JumpCloud.psd1 @@ -3,7 +3,7 @@ # # Generated by: JumpCloud Solutions Architect Team # -# Generated on: 9/8/2025 +# Generated on: 12/2/2025 # @{ @@ -12,7 +12,7 @@ RootModule = 'JumpCloud.psm1' # Version number of this module. -ModuleVersion = '2.18.2' +ModuleVersion = '3.0.0' # Supported PSEditions # CompatiblePSEditions = @() diff --git a/PowerShell/JumpCloud Module/JumpCloud.psm1 b/PowerShell/JumpCloud Module/JumpCloud.psm1 index 17c34bd6c..472790cd3 100644 --- a/PowerShell/JumpCloud Module/JumpCloud.psm1 +++ b/PowerShell/JumpCloud Module/JumpCloud.psm1 @@ -1,16 +1,22 @@ # Load all functions from public and private folders $Public = @( Get-ChildItem -Path "$PSScriptRoot/Public/*.ps1" -Recurse ) $Private = @( Get-ChildItem -Path "$PSScriptRoot/Private/*.ps1" -Recurse) -Foreach ($Import in @($Public + $Private)) { - Try { +foreach ($Import in @($Public + $Private)) { + try { . $Import.FullName - } Catch { + } catch { Write-Error -Message "Failed to import function $($Import.FullName): $_" } } # Check to see if parallel processing is available for the session $global:JCConfig = Get-JCSettingsFile +$PSDefaultParameterValues = $global:PSDefaultParameterValues.Clone() +if ($global:JCConfig['JCEnvironment'].Location) { + Write-Host "Setting JCEnvironment to: $($global:JCConfig['JCEnvironment'].Location) from JCModule settings file" -ForegroundColor Green + $env:JCEnvironment = $global:JCConfig['JCEnvironment'].Location +} +# set the JCEnvironment from the settings file if it exists # Set default values for function parameters $PSDefaultParameterValues['Invoke-RestMethod:ContentType'] = 'application/json; charset=utf-8' @@ -22,7 +28,7 @@ $PSDefaultParameterValues['Invoke-WebRequest:ContentType'] = 'application/json; [System.Net.ServicePointManager]::DefaultConnectionLimit = 999999; [System.Net.ServicePointManager]::MaxServicePointIdleTime = 600000; [System.Net.ServicePointManager]::MaxServicePoints = 999999; -If ($PSVersionTable.PSEdition -eq 'Core') { +if ($PSVersionTable.PSEdition -eq 'Core') { $PSDefaultParameterValues['Invoke-RestMethod:SkipCertificateCheck'] = $true $PSDefaultParameterValues['Invoke-RestMethod:SkipHeaderValidation'] = $true $PSDefaultParameterValues['Invoke-RestMethod:MaximumRetryCount'] = 1 @@ -32,9 +38,9 @@ If ($PSVersionTable.PSEdition -eq 'Core') { $PSDefaultParameterValues['Invoke-WebRequest:SkipHeaderValidation'] = $true $PSDefaultParameterValues['Invoke-WebRequest:MaximumRetryCount'] = 1 $PSDefaultParameterValues['Invoke-WebRequest:RetryIntervalSec'] = 1 -} Else { +} else { #Ignore SSL errors / do not add policy if it exists - if (-Not [System.Net.ServicePointManager]::CertificatePolicy) { + if (-not [System.Net.ServicePointManager]::CertificatePolicy) { Add-Type @" using System.Net; using System.Security.Cryptography.X509Certificates; @@ -67,7 +73,7 @@ Register-ArgumentCompleter -CommandName Get-JCSystemInsights -ParameterName Tabl param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter) $TypeFilter = $fakeBoundParameter.Name; - $SystemInsightsDataSet.Name | Where-Object { $_ -like "${TypeFilter}*" } | Where-Object { $_ -like "${wordToComplete}*" } | Sort-Object -Unique | ForEach-Object { $_ } + $SystemInsightsDataSet.Name | Where-Object { $_ -like "${TypeFilter}*" } | Where-Object { $_ -like "${wordToComplete}*" } | Sort-Object -Unique | ForEach-Object { $_ } } # Export module member Export-ModuleMember -Function $Public.BaseName -Alias * diff --git a/PowerShell/JumpCloud Module/Private/NestedFunctions/Invoke-JCApi.ps1 b/PowerShell/JumpCloud Module/Private/NestedFunctions/Invoke-JCApi.ps1 index dcd14f6a6..1ce261a86 100755 --- a/PowerShell/JumpCloud Module/Private/NestedFunctions/Invoke-JCApi.ps1 +++ b/PowerShell/JumpCloud Module/Private/NestedFunctions/Invoke-JCApi.ps1 @@ -1,6 +1,6 @@ -Function Invoke-JCApi { +function Invoke-JCApi { [CmdletBinding()] - Param( + param( [Parameter(Mandatory = $true, Position = 0)][ValidateNotNullOrEmpty()][string]$Url, [Parameter(Mandatory = $true, Position = 1)][ValidateNotNullOrEmpty()][string]$Method, [Parameter(Mandatory = $false, Position = 2)][ValidateNotNullOrEmpty()][ValidateRange(1, [int]::MaxValue)][int]$Limit = 100, @@ -10,15 +10,15 @@ Function Invoke-JCApi { [Parameter(Mandatory = $false, Position = 6)][ValidateNotNullOrEmpty()][bool]$Paginate = $false, [Parameter(Mandatory = $false, Position = 7)][ValidateNotNullOrEmpty()][switch]$ReturnCount ) - Begin { + begin { # Debug message for parameter call $PSBoundParameters | Out-DebugParameter | Write-Debug # Populate $env:JCApiKey if its not set - If ([System.String]::IsNullOrEmpty($env:JCApiKey)) { + if ([System.String]::IsNullOrEmpty($env:JCApiKey)) { Connect-JCOnline -force | Out-Null } # Populate $env:JCOrgId if its not set - If (-not [System.String]::IsNullOrEmpty($env:JCApiKey) -and [System.String]::IsNullOrEmpty($env:JCOrgId) -and $Url -notlike '*/api/organizations*') { + if (-not [System.String]::IsNullOrEmpty($env:JCApiKey) -and [System.String]::IsNullOrEmpty($env:JCOrgId) -and $Url -notlike '*/api/organizations*') { Set-JCOrganization -JumpCloudAPIKey:($env:JCApiKey) | Out-Null } #Set JC headers @@ -30,155 +30,159 @@ Function Invoke-JCApi { } # TODO: CUT-4439 need a dynamic list of endpoints that do not accept x-org-id # Organizations endpoint does not accept x-org-id in header - If ( + if ( ($Url -like '*/api/organizations*') -or ($URL -like "*/api/v2/providers/*") -or ($URL -like "*/api/v2/organizations/*")) { $Headers.Remove('x-org-id') | Out-Null } } - Process { - Try { + process { + try { $Results = @() - If ([System.String]::IsNullOrEmpty($JCUrlBasePath)) { - $JCUrlBasePath = 'https://console.jumpcloud.com' + if ([System.String]::IsNullOrEmpty($global:JCUrlBasePath)) { + if ($env:JCEnvironment -eq 'EU') { + $JCUrlBasePath = 'https://console.eu.jumpcloud.com' + } else { + $JCUrlBasePath = 'https://console.jumpcloud.com' + } } - If ($Url -notlike ('*' + $JCUrlBasePath + '*')) { + if ($Url -notlike ('*' + $JCUrlBasePath + '*')) { $Url = $JCUrlBasePath + $Url } - If ($Url -like '*`?*') { + if ($Url -like '*`?*') { $SearchOperator = '&' - } Else { + } else { $SearchOperator = '?' } # Convert passed in body to json - If ($Body) { + if ($Body) { $ObjectBody = $Body | ConvertFrom-Json - } Else { + } else { $ObjectBody = '' } # Pagination - Do { + do { $QueryStrings = @() # Add fields - If ($Fields) { + if ($Fields) { $JoinedFields = ($Fields -join ' ') - If ($ObjectBody.PSObject.Properties.name -eq 'fields') { + if ($ObjectBody.PSObject.Properties.name -eq 'fields') { $JoinedFields = $ObjectBody.fields - } Else { + } else { $ObjectBody = $ObjectBody | Select-Object *, @{Name = 'fields'; Expression = { $JoinedFields } } } - If ($Url -notlike '*fields*') { $QueryStrings += 'fields=' + $JoinedFields } + if ($Url -notlike '*fields*') { $QueryStrings += 'fields=' + $JoinedFields } } # Add limit - If ($ObjectBody.PSObject.Properties.name -eq 'limit') { + if ($ObjectBody.PSObject.Properties.name -eq 'limit') { $ObjectBody.limit = $Limit - } Else { + } else { $ObjectBody = $ObjectBody | Select-Object *, @{Name = 'limit'; Expression = { $Limit } } } - If ($Url -notlike '*limit*') { $QueryStrings += 'limit=' + $Limit } + if ($Url -notlike '*limit*') { $QueryStrings += 'limit=' + $Limit } # Add skip - If ($ObjectBody.PSObject.Properties.name -eq 'skip') { + if ($ObjectBody.PSObject.Properties.name -eq 'skip') { $ObjectBody.skip = $Skip - } Else { + } else { $ObjectBody = $ObjectBody | Select-Object *, @{Name = 'skip'; Expression = { $Skip } } } - If ($Url -notlike '*skip*') { $QueryStrings += 'skip=' + $Skip } + if ($Url -notlike '*skip*') { $QueryStrings += 'skip=' + $Skip } # Build url query string and body $ObjectBody = $ObjectBody | Select-Object -Property * -ExcludeProperty Length $Body = $ObjectBody | ConvertTo-Json -Depth:(10) -Compress | Sort-Object - If ($QueryStrings) { + if ($QueryStrings) { $Uri = $Url + $SearchOperator + (($QueryStrings | Sort-Object) -join '&') - } Else { + } else { $Uri = $Url } # Run request $UserAgent = Get-JCUserAgent Write-Verbose ('Connecting to: ' + $Uri) # PowerShell 5 won't let you send a GET with a body. - If ($Method -eq 'GET') { + if ($Method -eq 'GET') { Write-Debug("[CallFunction]: Invoke-WebRequest -Method:('$Method') -Headers:(@" + ($Headers | ConvertTo-Json -Compress).Replace(':', '=').Replace(',', ';') + ") -Uri:('$Uri') -UseBasicParsing -UserAgent:('$UserAgent')") $RequestResult = Invoke-WebRequest -Method:($Method) -Headers:($Headers) -Uri:($Uri) -UserAgent:($UserAgent) -UseBasicParsing - } Else { + } else { Write-Debug("[CallFunction]: Invoke-WebRequest -Method:('$Method') -Headers:(@" + ($Headers | ConvertTo-Json -Compress).Replace(':', '=').Replace(',', ';') + ") -Uri:('$Uri') -UseBasicParsing -UserAgent:('$UserAgent') -Body:('$Body')") $RequestResult = Invoke-WebRequest -Method:($Method) -Headers:($Headers) -Uri:($Uri) -UserAgent:($UserAgent) -Body:($Body) -UseBasicParsing } - If ($RequestResult) { + if ($RequestResult) { $Result = $RequestResult.Content | ConvertFrom-Json $httpMetaData = $RequestResult | Select-Object -Property:('*') -ExcludeProperty:('Content') - If ($Result) { + if ($Result) { $ResultPopulated = $false # Specific logic for v1 and v2 api specs - If ($Url -like '*/api/*' -and ($Url -notlike '*/api/v2/*' -and $Result.PSObject.Properties.name -eq 'results')) { + if ($Url -like '*/api/*' -and ($Url -notlike '*/api/v2/*' -and $Result.PSObject.Properties.name -eq 'results')) { $ResultCount = ($Result.results | Measure-Object).Count - If ($ResultCount -gt 0) { + if ($ResultCount -gt 0) { $ResultPopulated = $true - If ($ReturnCount) { + if ($ReturnCount) { $ResultObjects = $Result $Paginate = $false - } Else { + } else { $ResultObjects = $Result.results } } - } ElseIf ($Url -like '*/api/*' -and ($Url -like '*/api/v2/*' -or $Result.PSObject.Properties.name -ne 'results')) { + } elseif ($Url -like '*/api/*' -and ($Url -like '*/api/v2/*' -or $Result.PSObject.Properties.name -ne 'results')) { $ResultCount = ($Result | Measure-Object).Count - If ($ResultCount -gt 0) { + if ($ResultCount -gt 0) { $ResultPopulated = $true - If ($ReturnCount) { + if ($ReturnCount) { $ResultObjects = [PSCustomObject]@{'totalCount' = [int](($httpMetaData.Headers.'X-Total-Count') -join ','); 'results' = $Result; } $Paginate = $false - } Else { + } else { $ResultObjects = $Result } } - } Else { + } else { Write-Error ('Url is not a valid JumpCloud V1 or V2 endpoint') } - If ($ResultPopulated -eq $true) { + if ($ResultPopulated -eq $true) { $Skip += $ResultCount $Results += $ResultObjects } - } Else { - If ($Paginate) { + } else { + if ($Paginate) { $ResultCount = ($Result | Measure-Object).Count } } } Write-Debug ('Paginate:' + [string]$Paginate + ';ResultsCount:' + [string]$ResultCount + ';Limit:' + [string]$Limit + ';') } - While ($Paginate -and $ResultCount -eq $Limit) + while ($Paginate -and $ResultCount -eq $Limit) Write-Verbose ('Returned ' + [string]($Results | Measure-Object).Count + ' total results.') - } Catch { + } catch { Invoke-Command -ScriptBlock:($ScriptBlock_TryCatchError) -ArgumentList:($_, $true) -NoNewScope } } - End { + end { # List values to add to results $HiddenProperties = @('httpMetaData') # Validate that all fields passed into the function exist in the output - If ($Results) { + if ($Results) { # Append meta info to each result record Get-Variable -Name:($HiddenProperties) | - ForEach-Object { - $Variable = $_ - $Results | ForEach-Object { - Add-Member -InputObject:($_) -MemberType:('NoteProperty') -Name:($Variable.Name) -Value:($Variable.Value) - } - } + $Variable = $_ + $Results | + ForEach-Object { + Add-Member -InputObject:($_) -MemberType:('NoteProperty') -Name:($Variable.Name) -Value:($Variable.Value) + } + } # Validate results properties returned $Fields | ForEach-Object { - If ($_ -notin ($Results | ForEach-Object { $_.PSObject.Properties.Name } | Select-Object -Unique)) { + if ($_ -notin ($Results | ForEach-Object { $_.PSObject.Properties.Name } | Select-Object -Unique)) { Write-Warning ('API output does not contain the field "' + $_ + '". Please refer to https://docs.jumpcloud.com for API endpoint field names.') } } - } Else { + } else { $Results += [PSCustomObject]@{ 'NoContent' = $null; 'httpMetaData' = $httpMetaData; } } # Set the meta info to be hidden by default - Return Hide-ObjectProperty -Object:($Results) -HiddenProperties:($HiddenProperties) + return Hide-ObjectProperty -Object:($Results) -HiddenProperties:($HiddenProperties) } } diff --git a/PowerShell/JumpCloud Module/Private/Policies/Get-JCPolicyTemplateConfigField.ps1 b/PowerShell/JumpCloud Module/Private/Policies/Get-JCPolicyTemplateConfigField.ps1 index 5ec3640bc..ac44b58d4 100644 --- a/PowerShell/JumpCloud Module/Private/Policies/Get-JCPolicyTemplateConfigField.ps1 +++ b/PowerShell/JumpCloud Module/Private/Policies/Get-JCPolicyTemplateConfigField.ps1 @@ -10,7 +10,7 @@ function Get-JCPolicyTemplateConfigField { $headers = @{} $headers.Add("x-api-key", $env:JCApiKey) $headers.Add("x-org-id", $env:JCOrgId) - $template = Invoke-RestMethod -Uri "https://console.jumpcloud.com/api/v2/policytemplates/$templateID" -Method GET -Headers $headers + $template = Invoke-RestMethod -Uri "$global:JCUrlBasePath/api/v2/policytemplates/$templateID" -Method GET -Headers $headers # define policy config field mapping $PolicyConfigMapping = @{ checkbox = 'boolean' @@ -71,7 +71,7 @@ function Get-JCPolicyTemplateConfigField { value = $null defaultValue = $field.defaultValue } - $objectMap.Add($templateObject) | out-null + $objectMap.Add($templateObject) | Out-Null } # Build object to return, including template displayname $templateObject = [PSCustomObject]@{ diff --git a/PowerShell/JumpCloud Module/Private/settings/New-JCSettingsFile.ps1 b/PowerShell/JumpCloud Module/Private/settings/New-JCSettingsFile.ps1 index 9d9b69bf8..4c60e149d 100644 --- a/PowerShell/JumpCloud Module/Private/settings/New-JCSettingsFile.ps1 +++ b/PowerShell/JumpCloud Module/Private/settings/New-JCSettingsFile.ps1 @@ -11,19 +11,23 @@ function New-JCSettingsFile { begin { # Config should be in /PowerShell/JumpCloudModule/Config.json $ModuleRoot = (Get-Item -Path:($PSScriptRoot)).Parent.Parent.FullName - $configFilePath = join-path -path $ModuleRoot -childpath 'Config.json' + $configFilePath = Join-Path -Path $ModuleRoot -ChildPath 'Config.json' + $JCEnvironmentValue = if ($env:JCEnvironment -eq 'STANDARD' -or [System.String]::IsNullOrEmpty($env:JCEnvironment)) { 'STANDARD' } else { $env:JCEnvironment } # Define Default Settings for the Config file $config = @{ - 'moduleBanner' = @{ - 'Message' = @{value = 'JumpCloud PowerShell Module now processes Get requests in parallel, to disable this functionailty run: Set-JCSettingsFile -parallelOverride $true'; write = $false; copy = $false }; + 'moduleBanner' = @{ + 'Message' = @{value = 'JumpCloud PowerShell Module now supports EU based organizations. Use `Set-JCSettingsFile -JCEnvironmentLocation "EU"` or `Connect-JCOnline -JumpCloudAPIKey "APIKEY" -JCEnvironment "EU"` to update'; write = $false; copy = $false }; 'MessageCount' = @{value = 0; write = $true; copy = $false } } - 'parallel' = @{ + 'parallel' = @{ 'Eligible' = @{value = Get-JCParallelValidation; write = $false; copy = $true } 'Override' = @{value = $false; write = $true; copy = $true } 'Calculated' = @{value = $false; write = $false; copy = $true } } + 'JCEnvironment' = @{ + 'Location' = @{value = $JCEnvironmentValue; write = $true; copy = $true } + } # TODO: in future version, add the updates hash and limit update frequency # 'updates' = @{ # 'Frequency' = @{value = 'day'; write = $true; copy = $true; validateSet = 'day week month' } @@ -34,9 +38,9 @@ function New-JCSettingsFile { process { # Calculate the Parallel Setting Field: - if (($config.parallel.Override.value -eq $true) -And ($config.parallel.Eligible.value -eq $true)) { + if (($config.parallel.Override.value -eq $true) -and ($config.parallel.Eligible.value -eq $true)) { $config.parallel.Calculated.value = $false - } elseif (($config.parallel.Override.value -eq $false) -And ($config.parallel.Eligible.value -eq $true)) { + } elseif (($config.parallel.Override.value -eq $false) -and ($config.parallel.Eligible.value -eq $true)) { $config.parallel.Calculated.value = $true } else { $config.parallel.Calculated.value = $false @@ -54,7 +58,7 @@ function New-JCSettingsFile { } end { - if ((test-path -Path $configFilePath) -And ($force)) { + if ((Test-Path -Path $configFilePath) -and ($force)) { $config | ConvertTo-Json | Out-File -FilePath $configFilePath } else { $config | ConvertTo-Json | Out-File -FilePath $configFilePath diff --git a/PowerShell/JumpCloud Module/Public/Administrators/Get-JCAdmin.ps1 b/PowerShell/JumpCloud Module/Public/Administrators/Get-JCAdmin.ps1 index 9d54f5c5e..fa600760b 100644 --- a/PowerShell/JumpCloud Module/Public/Administrators/Get-JCAdmin.ps1 +++ b/PowerShell/JumpCloud Module/Public/Administrators/Get-JCAdmin.ps1 @@ -53,7 +53,7 @@ function Get-JCAdmin { $orgId = $_.orgId $headers.Add("x-org-id", $orgId) - $response = Invoke-RestMethod -Uri 'https://console.jumpcloud.com/api/users' -Method GET -Headers $headers + $response = Invoke-RestMethod -Uri "$global:JCUrlBasePath/api/users" -Method GET -Headers $headers # For some reason an admin's organization is not set, manually set $response.results | ForEach-Object { diff --git a/PowerShell/JumpCloud Module/Public/Authentication/Connect-JCOnline.ps1 b/PowerShell/JumpCloud Module/Public/Authentication/Connect-JCOnline.ps1 index 9708f2002..9550f1d2b 100755 --- a/PowerShell/JumpCloud Module/Public/Authentication/Connect-JCOnline.ps1 +++ b/PowerShell/JumpCloud Module/Public/Authentication/Connect-JCOnline.ps1 @@ -1,6 +1,6 @@ -Function Connect-JCOnline () { +function Connect-JCOnline () { [CmdletBinding()] - Param + param ( [Parameter( ParameterSetName = 'force', @@ -8,7 +8,7 @@ Function Connect-JCOnline () { )] [Switch]$force ) - DynamicParam { + dynamicparam { $Param_JumpCloudApiKey = @{ 'Name' = 'JumpCloudApiKey'; 'Type' = [System.String]; @@ -31,24 +31,24 @@ Function Connect-JCOnline () { 'Position' = 3; 'ValueFromPipelineByPropertyName' = $true; 'ValidateNotNullOrEmpty' = $true; - 'HelpMessage' = 'Specific to JumpCloud development team to connect to staging dev environment.'; - 'ValidateSet' = ('production', 'staging'); + 'HelpMessage' = 'Enter the region for your JumpCloud organization; "EU" or "STANDARD".'; + 'ValidateSet' = ('STANDARD', 'staging', 'EU'); } # If the $env:JCApiKey is not set then make the JumpCloudApiKey mandatory else set the default value to be the env variable - If ([System.String]::IsNullOrEmpty($env:JCApiKey)) { + if ([System.String]::IsNullOrEmpty($env:JCApiKey)) { $Param_JumpCloudApiKey.Add('Mandatory', $true); - } Else { + } else { $Param_JumpCloudApiKey.Add('Default', $env:JCApiKey); } # If the $env:JCOrgId is set then set the default value to be the env variable - If (-not [System.String]::IsNullOrEmpty($env:JCOrgId)) { + if (-not [System.String]::IsNullOrEmpty($env:JCOrgId)) { $Param_JumpCloudOrgId.Add('Default', $env:JCOrgId); } # If the $env:JCEnvironment is set then set the default value to be the env variable - If (-not [System.String]::IsNullOrEmpty($env:JCEnvironment)) { + if (-not [System.String]::IsNullOrEmpty($env:JCEnvironment)) { $Param_JCEnvironment.Add('Default', $env:JCEnvironment); - } Else { - $Param_JCEnvironment.Add('Default', 'production'); + } else { + $Param_JCEnvironment.Add('Default', 'STANDARD'); } # Build output # Build parameter array @@ -60,86 +60,102 @@ Function Connect-JCOnline () { # Creating each parameter $VarName = $_.Name $VarValue = $_.Value - Try { + try { New-DynamicParameter @VarValue | Out-Null - } Catch { + } catch { Write-Error -Message:('Unable to create dynamic parameter:"' + $VarName.Replace($ParamVarPrefix, '') + '"; Error:' + $Error) } } - $IndShowMessages = If ([System.String]::IsNullOrEmpty($JumpCloudApiKey) -and [System.String]::IsNullOrEmpty($JumpCloudOrgId) -and -not [System.String]::IsNullOrEmpty($env:JCApiKey) -and -not [System.String]::IsNullOrEmpty($env:JCOrgId)) { + $IndShowMessages = if ([System.String]::IsNullOrEmpty($JumpCloudApiKey) -and [System.String]::IsNullOrEmpty($JumpCloudOrgId) -and -not [System.String]::IsNullOrEmpty($env:JCApiKey) -and -not [System.String]::IsNullOrEmpty($env:JCOrgId)) { $false - } Else { + } else { $true } - Return $RuntimeParameterDictionary + return $RuntimeParameterDictionary } - Begin { + begin { # Debug message for parameter call $PSBoundParameters | Out-DebugParameter | Write-Debug } - Process { + process { # Load color scheme $JCColorConfig = Get-JCColorConfig # For DynamicParam with a default value set that value and then convert the DynamicParam inputs into new variables for the script to use Invoke-Command -ScriptBlock:($ScriptBlock_DefaultDynamicParamProcess) -ArgumentList:($PsBoundParameters, $PSCmdlet, $RuntimeParameterDictionary) -NoNewScope - Try { + try { #Region Set environment variables that can be used by other scripts - # If "$JCEnvironment" is populated or if "$env:JCEnvironment" is not set - If (-not [System.String]::IsNullOrEmpty($JCEnvironment)) { + if ([System.String]::IsNullOrEmpty($JCEnvironment)) { + $env:JCEnvironment = $JCConfig.JCEnvironment.location + $global:JCEnvironment = $env:JCEnvironment + } else { # Set $env:JCEnvironment $env:JCEnvironment = $JCEnvironment $global:JCEnvironment = $env:JCEnvironment + Set-JCSettingsFile -JCEnvironmentLocation $JCEnvironment } - $global:JCUrlBasePath = Switch ($JCEnvironment) { - 'production' { - "https://console.jumpcloud.com" + + switch ($env:JCEnvironment) { + 'STANDARD' { + $global:JCUrlBasePath = "https://console.jumpcloud.com" + $PSDefaultParameterValues['*-JcSdk*:ApiHost'] = "api" + $PSDefaultParameterValues['*-JcSdk*:ConsoleHost'] = "console" + $env:JCEnvironment = 'STANDARD' } 'staging' { - "https://console.awsstg.jumpcloud.com" + $global:JCUrlBasePath = "https://console.awsstg.jumpcloud.com" + } + 'EU' { + $global:JCUrlBasePath = "https://console.eu.jumpcloud.com" + $PSDefaultParameterValues['*-JcSdk*:ApiHost'] = "api.eu" + $PSDefaultParameterValues['*-JcSdk*:ConsoleHost'] = "console.eu" + $env:JCEnvironment = 'EU' } - Default { - Write-Error ('Unknown value for $JCEnvironment.') + default { + $global:JCUrlBasePath = "https://console.jumpcloud.com" + $PSDefaultParameterValues['*-JcSdk*:ApiHost'] = "api" + $PSDefaultParameterValues['*-JcSdk*:ConsoleHost'] = "console" + $env:JCEnvironment = 'STANDARD' } } # If "$JumpCloudApiKey" is populated set $env:JCApiKey - If (-not [System.String]::IsNullOrEmpty($JumpCloudApiKey)) { + if (-not [System.String]::IsNullOrEmpty($JumpCloudApiKey)) { $env:JCApiKey = $JumpCloudApiKey $global:JCAPIKEY = $env:JCApiKey } # Set $env:JCOrgId in Set-JCOrganization try { - $Auth = If ([System.String]::IsNullOrEmpty($JumpCloudOrgId) -and [System.String]::IsNullOrEmpty($env:JCOrgId)) { + $Auth = if ([System.String]::IsNullOrEmpty($JumpCloudOrgId) -and [System.String]::IsNullOrEmpty($env:JCOrgId)) { Set-JCOrganization -JumpCloudApiKey:($env:JCApiKey) -ErrorVariable api_err - } ElseIf (-not [System.String]::IsNullOrEmpty($JumpCloudOrgId) -and [System.String]::IsNullOrEmpty($env:JCOrgId)) { + } elseif (-not [System.String]::IsNullOrEmpty($JumpCloudOrgId) -and [System.String]::IsNullOrEmpty($env:JCOrgId)) { Set-JCOrganization -JumpCloudApiKey:($env:JCApiKey) -JumpCloudOrgId:($JumpCloudOrgId) -ErrorVariable api_err - } ElseIf ([System.String]::IsNullOrEmpty($JumpCloudOrgId) -and -not [System.String]::IsNullOrEmpty($env:JCOrgId)) { + } elseif ([System.String]::IsNullOrEmpty($JumpCloudOrgId) -and -not [System.String]::IsNullOrEmpty($env:JCOrgId)) { Set-JCOrganization -JumpCloudApiKey:($env:JCApiKey) -JumpCloudOrgId:($env:JCOrgId) -ErrorVariable api_err - } ElseIf (-not [System.String]::IsNullOrEmpty($JumpCloudOrgId) -and -not [System.String]::IsNullOrEmpty($env:JCOrgId) -and $JumpCloudOrgId -ne $env:JCOrgId) { + } elseif (-not [System.String]::IsNullOrEmpty($JumpCloudOrgId) -and -not [System.String]::IsNullOrEmpty($env:JCOrgId) -and $JumpCloudOrgId -ne $env:JCOrgId) { Set-JCOrganization -JumpCloudApiKey:($env:JCApiKey) -JumpCloudOrgId:($JumpCloudOrgId) -ErrorVariable api_err - } Else { + } else { Write-Debug ('The $JumpCloudOrgId supplied matches existing $env:JCOrgId.') Set-JCOrganization -JumpCloudApiKey:($env:JCApiKey) -JumpCloudOrgId:($env:JCOrgId) -ErrorVariable api_err } } catch { Write-Verbose "Error: Unable to validate API Key" } - If (-not [System.String]::IsNullOrEmpty($Auth)) { + if (-not [System.String]::IsNullOrEmpty($Auth)) { # Each time a new org is selected get settings info $global:JCSettingsUrl = $JCUrlBasePath + '/api/settings' $global:JCSettings = Invoke-JCApi -Method:('GET') -Url:($JCSettingsUrl) $global:JCOrgSettings = (Get-JcSdkOrganization -Id $env:JCOrgId).Settings #EndRegion Set environment variables that can be used by other scripts - If (([System.String]::IsNullOrEmpty($JCOrgId)) -or ([System.String]::IsNullOrEmpty($env:JCOrgId))) { + if (([System.String]::IsNullOrEmpty($JCOrgId)) -or ([System.String]::IsNullOrEmpty($env:JCOrgId))) { Write-Error ('Incorrect JumpCloudOrgID OR no network connectivity. You can obtain your Organization Id below your Organization''s Contact Information on the Settings page.') - Break + break } - If (([System.String]::IsNullOrEmpty($JCAPIKEY)) -or ([System.String]::IsNullOrEmpty($env:JCApiKey))) { + if (([System.String]::IsNullOrEmpty($JCAPIKEY)) -or ([System.String]::IsNullOrEmpty($env:JCApiKey))) { Write-Error ('Incorrect API key OR no network connectivity. To locate your JumpCloud API key log into the JumpCloud admin portal. The API key is located with "API Settings" accessible from the drop down in the top right hand corner of the screen') - Break + break } # Check for updates to the module and only prompt if user has not been prompted during the session already - If (!($force)) { - If ([System.String]::IsNullOrEmpty($env:JcUpdateModule) -or $env:JcUpdateModule -eq 'True') { + if (!($force)) { + if ([System.String]::IsNullOrEmpty($env:JcUpdateModule) -or $env:JcUpdateModule -eq 'True') { # Update-JCModule depends on these resources being available, check if available then continue $moduleSites = @( 'https://github.com/TheJumpCloud/support/blob/master/PowerShell/ModuleChangelog.md', @@ -154,14 +170,14 @@ Function Connect-JCOnline () { $HTTP_Response = $_.Exception.Response } $HTTP_Status = [int]$HTTP_Response.StatusCode - If ($HTTP_Status -eq 200) { + if ($HTTP_Status -eq 200) { } #Site is working properly - Else { + else { $downRepo += $site } # Clean up the http request by closing it. - If ($HTTP_Response -eq $null) { - } Else { + if ($HTTP_Response -eq $null) { + } else { $HTTP_Response.Close() } } @@ -173,7 +189,7 @@ Function Connect-JCOnline () { ($updateStatus = Update-JCModule) | Out-Null } } - If ($IndShowMessages) { + if ($IndShowMessages) { Write-Host ('Connection Status:') -BackgroundColor:($JCColorConfig.BackgroundColor) -ForegroundColor:($JCColorConfig.ForegroundColor_Header) Write-Host ($JCColorConfig.IndentChar) -BackgroundColor:($JCColorConfig.BackgroundColor) -ForegroundColor:($JCColorConfig.ForegroundColor_Indentation) -NoNewline Write-Host ('Successfully connected to JumpCloud!') -BackgroundColor:($JCColorConfig.BackgroundColor) -ForegroundColor:($JCColorConfig.ForegroundColor_Body) @@ -188,7 +204,7 @@ Function Connect-JCOnline () { Write-Host ('Notice:') -BackgroundColor:($JCColorConfig.BackgroundColor) -ForegroundColor:($JCColorConfig.ForegroundColor_Header) Write-Host ($JCColorConfig.IndentChar) -BackgroundColor:($JCColorConfig.BackgroundColor) -ForegroundColor:($JCColorConfig.ForegroundColor_Indentation) -NoNewline Write-Host $JCConfig.moduleBanner.Message -BackgroundColor:($JCColorConfig.BackgroundColor) -ForegroundColor:($JCColorConfig.ForegroundColor_Body) - If (-Not $updateStatus) { + if (-not $updateStatus) { # If we recently updated the module, do not update messageCount Set-JCSettingsFile -moduleBannerMessageCount ($JCConfig.moduleBanner.messagecount + 1) } @@ -200,11 +216,11 @@ Function Connect-JCOnline () { # 'JCOrgId' = $Auth.JCOrgId; # 'JCOrgName' = $Auth.JCOrgName; # } - } Else { + } else { Write-Verbose "Error: Unable to set module authentication" } # set Argument Completer(s) which require authentication - $templates = Get-JCSDKPolicyTemplate + $templates = Get-JcSdkPolicyTemplate $global:TemplateNameList = New-Object System.Collections.ArrayList foreach ($template in $templates) { $templateHashObject = [PSCustomObject]@{ @@ -218,13 +234,13 @@ Function Connect-JCOnline () { param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter) $TypeFilter = $fakeBoundParameter.Name; - $TemplateNameList.Name | Where-Object { $_ -like "${TypeFilter}*" } | Where-Object { $_ -like "${wordToComplete}*" } | Sort-Object -Unique | ForEach-Object { $_ } + $TemplateNameList.Name | Where-Object { $_ -like "${TypeFilter}*" } | Where-Object { $_ -like "${wordToComplete}*" } | Sort-Object -Unique | ForEach-Object { $_ } } - } Catch { - Throw "Unable to authenticate: $_" + } catch { + throw "Unable to authenticate: $_" } } - End { + end { } -} +} \ No newline at end of file diff --git a/PowerShell/JumpCloud Module/Public/Authentication/Set-JCOrganization.ps1 b/PowerShell/JumpCloud Module/Public/Authentication/Set-JCOrganization.ps1 index f85889861..b5e12c584 100644 --- a/PowerShell/JumpCloud Module/Public/Authentication/Set-JCOrganization.ps1 +++ b/PowerShell/JumpCloud Module/Public/Authentication/Set-JCOrganization.ps1 @@ -1,54 +1,54 @@ -Function Set-JCOrganization { +function Set-JCOrganization { [CmdletBinding()] - Param( + param( [Parameter(HelpMessage = 'Please enter your JumpCloud API key. This can be found in the JumpCloud admin console within "API Settings" accessible from the drop down icon next to the admin email address in the top right corner of the JumpCloud admin console.')][ValidateNotNullOrEmpty()][System.String]$JumpCloudApiKey = $env:JCApiKey , [Parameter(HelpMessage = 'Organization Id can be found in the Settings page within the admin console. Only needed for multi tenant admins.')][ValidateNotNullOrEmpty()][System.String]$JumpCloudOrgId = $env:JCOrgId ) - Begin { + begin { # Debug message for parameter call $PSBoundParameters | Out-DebugParameter | Write-Debug } - Process { + process { # Load color scheme $JCColorConfig = Get-JCColorConfig # If "$JumpCloudOrgId" is populated set $env:JCOrgId - If (-not [System.String]::IsNullOrEmpty($JumpCloudOrgId)) { + if (-not [System.String]::IsNullOrEmpty($JumpCloudOrgId)) { $env:JCOrgId = $JumpCloudOrgId $global:JCOrgId = $env:JCOrgId } # Set $env:JCApiKey in Connect-JCOnline - If ([System.String]::IsNullOrEmpty($JumpCloudApiKey) -and [System.String]::IsNullOrEmpty($env:JCApiKey)) { + if ([System.String]::IsNullOrEmpty($JumpCloudApiKey) -and [System.String]::IsNullOrEmpty($env:JCApiKey)) { Connect-JCOnline - } ElseIf ((-not [System.String]::IsNullOrEmpty($JumpCloudApiKey) -and [System.String]::IsNullOrEmpty($env:JCApiKey))) { + } elseif ((-not [System.String]::IsNullOrEmpty($JumpCloudApiKey) -and [System.String]::IsNullOrEmpty($env:JCApiKey))) { Connect-JCOnline -JumpCloudApiKey:($JumpCloudApiKey) - } ElseIf ([System.String]::IsNullOrEmpty($JumpCloudApiKey) -and -not [System.String]::IsNullOrEmpty($env:JCApiKey)) { + } elseif ([System.String]::IsNullOrEmpty($JumpCloudApiKey) -and -not [System.String]::IsNullOrEmpty($env:JCApiKey)) { Connect-JCOnline -JumpCloudApiKey:($env:JCApiKey) - } ElseIf ((-not [System.String]::IsNullOrEmpty($JumpCloudApiKey) -and -not [System.String]::IsNullOrEmpty($env:JCApiKey)) -and $JumpCloudApiKey -ne $env:JCApiKey) { + } elseif ((-not [System.String]::IsNullOrEmpty($JumpCloudApiKey) -and -not [System.String]::IsNullOrEmpty($env:JCApiKey)) -and $JumpCloudApiKey -ne $env:JCApiKey) { Connect-JCOnline -JumpCloudApiKey:($JumpCloudApiKey) - } Else { + } else { # Auth has been verified } - If ((-not [System.String]::IsNullOrEmpty($JumpCloudApiKey) -and -not [System.String]::IsNullOrEmpty($env:JCApiKey)) -and $JumpCloudApiKey -eq $env:JCApiKey) { + if ((-not [System.String]::IsNullOrEmpty($JumpCloudApiKey) -and -not [System.String]::IsNullOrEmpty($env:JCApiKey)) -and $JumpCloudApiKey -eq $env:JCApiKey) { Write-Verbose ("Parameter Set: $($PSCmdlet.ParameterSetName)") Write-Verbose ('Populating JCOrganizations') try { $Organizations = Get-JCObject -Type:('organization') -Fields:('_id', 'displayName') -ErrorVariable api_err } catch { - Throw + throw } - If (-not [System.String]::IsNullOrEmpty($Organizations)) { - If ($Organizations.Count -gt 1) { + if (-not [System.String]::IsNullOrEmpty($Organizations)) { + if ($Organizations.Count -gt 1) { # Set the JCProviderID $JCProviderHeaders = @{ 'x-api-key' = $env:JCApiKey } - $ProviderResponse = Invoke-RestMethod -Uri 'https://console.jumpcloud.com/api/users/getSelf?fields=provider' -Method GET -Headers $JCProviderHeaders - If ($ProviderResponse) { + $ProviderResponse = Invoke-RestMethod -Uri "$global:JCUrlBasePath/api/users/getSelf?fields=provider" -Method GET -Headers $JCProviderHeaders + if ($ProviderResponse) { $env:JCProviderId = $ProviderResponse.provider } # If not JumpCloudOrgId was specified or if the specified JumpCloudOrgId does not exist within the list of available organizations prompt for selection - If ([System.String]::IsNullOrEmpty($JumpCloudOrgId) -or $JumpCloudOrgId -notin $Organizations._id) { + if ([System.String]::IsNullOrEmpty($JumpCloudOrgId) -or $JumpCloudOrgId -notin $Organizations._id) { $OrgIdHash = [ordered]@{ } $OrgNameHash = [ordered]@{ } # Build user menu @@ -58,10 +58,10 @@ Function Set-JCOrganization { [Int32]$menuNumber = 1 Write-Host ('======= JumpCloud Multi Tenant Selector =======') -BackgroundColor:($JCColorConfig.BackgroundColor) -ForegroundColor:($JCColorConfig.ForegroundColor_Header) Write-Host ($MenuItemTemplate -f ' ', 'JCOrgName', 'JCOrgId') -BackgroundColor:($JCColorConfig.BackgroundColor) -ForegroundColor:($JCColorConfig.ForegroundColor_Action) - ForEach ($Org In $Organizations) { - $FormattedMenuNumber = If (([System.String]$menuNumber).Length -eq 1) { + foreach ($Org in $Organizations) { + $FormattedMenuNumber = if (([System.String]$menuNumber).Length -eq 1) { ' ' + [System.String]$menuNumber - } Else { + } else { [System.String]$menuNumber } Write-Host ($MenuItemTemplate -f ($FormattedMenuNumber + '.' ), $Org.displayName, $Org._id) -BackgroundColor:($JCColorConfig.BackgroundColor) -ForegroundColor:($JCColorConfig.ForegroundColor_Body) @@ -70,39 +70,39 @@ Function Set-JCOrganization { $menuNumber++ } # Prompt user for org selection - Do { + do { Write-Host ('Select JumpCloud tenant you wish to connect to. Enter a value between 1 and ' + [System.String]$OrgIdHash.Count + ':') -BackgroundColor:($JCColorConfig.BackgroundColor) -ForegroundColor:($JCColorConfig.ForegroundColor_UserPrompt) -NoNewline - Write-Host (' ') -NoNewLine + Write-Host (' ') -NoNewline [Int32]$UserSelection = Read-Host } - Until ($UserSelection -le $OrgIdHash.Count) + until ($UserSelection -le $OrgIdHash.Count) $OrgId = $($OrgIdHash.$UserSelection) $OrgName = $($OrgNameHash.$UserSelection) - } Else { + } else { $OrgId = ($Organizations | Where-Object { $_._id -eq $JumpCloudOrgId })._id $OrgName = ($Organizations | Where-Object { $_._id -eq $JumpCloudOrgId }).displayName } - } Else { + } else { $OrgId = $($Organizations._id) $OrgName = $($Organizations.displayName) } - If (-not ([System.String]::IsNullOrEmpty($OrgId))) { + if (-not ([System.String]::IsNullOrEmpty($OrgId))) { $env:JCOrgId = $OrgId $global:JCOrgId = $env:JCOrgId $env:JCOrgName = $OrgName - Return [PSCustomObject]@{ + return [PSCustomObject]@{ # 'JCApiKey' = $env:JCApiKey; 'JCOrgId' = $env:JCOrgId; 'JCOrgName' = $env:JCOrgName; } - } Else { + } else { Write-Error ('OrgId has not been set.') } - } Else { + } else { Write-Error ('Unable to get organization info.') } } } - End { + end { } } diff --git a/PowerShell/JumpCloud Module/Public/Commands/Get-JCCommand.ps1 b/PowerShell/JumpCloud Module/Public/Commands/Get-JCCommand.ps1 index 5835bbf2b..4e5c9e527 100644 --- a/PowerShell/JumpCloud Module/Public/Commands/Get-JCCommand.ps1 +++ b/PowerShell/JumpCloud Module/Public/Commands/Get-JCCommand.ps1 @@ -1,5 +1,5 @@ -Function Get-JCCommand () { +function Get-JCCommand () { [CmdletBinding(DefaultParameterSetName = 'SearchFilter')] param @@ -21,7 +21,7 @@ Function Get-JCCommand () { [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'',''listensTo'',''organization'',''commandRunners'',''schedule'',''shell'',''timeout'',''sudo'',''template'',''scheduleYear'',''timeToLiveSeconds'',''files'',''user'',''systems'', ''description'', ''filesS3''')] - [ValidateSet('command', 'name', 'launchType', 'commandType', 'trigger', 'scheduleRepeatType', 'listensTo', 'organization', 'commandRunners', 'schedule', 'shell', 'timeout', 'sudo', 'template', 'scheduleYear', 'timeToLiveSeconds', 'files', 'user', 'systems', 'description', 'filesS3')] + [ValidateSet('aiGenerated', 'command', 'name', 'launchType', 'commandType', 'trigger', 'scheduleRepeatType', 'listensTo', 'organization', 'commandRunners', 'schedule', 'shell', 'timeout', 'sudo', 'template', 'scheduleYear', 'timeToLiveSeconds', 'files', 'user', 'systems', 'description', 'filesS3')] [String[]]$returnProperties, [Parameter(Mandatory, ValueFromPipelineByPropertyName, diff --git a/PowerShell/JumpCloud Module/Public/DirectoryInsights/Get-JCEvent.ps1 b/PowerShell/JumpCloud Module/Public/DirectoryInsights/Get-JCEvent.ps1 index b9978752a..8b9dde776 100644 --- a/PowerShell/JumpCloud Module/Public/DirectoryInsights/Get-JCEvent.ps1 +++ b/PowerShell/JumpCloud Module/Public/DirectoryInsights/Get-JCEvent.ps1 @@ -11,38 +11,38 @@ Query the API for Directory Insights events ``` curl -X POST 'https://api.jumpcloud.com/insights/directory/v1/events' -H 'Content-Type: application/json' -H 'x-api-key: REPLACE_KEY_VALUE' --data '{\"service\": [\"all\"], \"start_time\": \"2021-07-14T23:00:00Z\", \"end_time\": \"2021-07-28T14:00:00Z\", \"sort\": \"DESC\", \"fields\": [\"timestamp\", \"event_type\", \"initiated_by\", \"success\", \"client_ip\", \"provider\", \"organization\"]}' ``` -.Example +.Example PS C:\> Get-JCEvent -Service:('all') -StartTime:((Get-date).AddDays(-30)) -Pull all event records from the last thirty days -.Example +Pull all event records from the last thirty days +.Example PS C:\> Get-JCEvent -Service:('directory') -StartTime:((Get-date).AddHours(-1)) -Limit:('10') -Get directory results from the last hour limit to the last 10 results in the time range -.Example +Get directory results from the last hour limit to the last 10 results in the time range +.Example PS C:\> Get-JCEvent -Service:('directory') -StartTime:((Get-date).AddDays(-30)) -Sort:("DESC") -EndTime:((Get-date).AddDays(-5)) -Get directory results between 30 and 5 days ago, sort timestamp by descending value -.Example +Get directory results between 30 and 5 days ago, sort timestamp by descending value +.Example PS C:\> Get-JCEvent -Service:('directory') -StartTime:((Get-date).AddDays(-30)) -Limit:('10') -searchTermAnd:@{"event_type" = "group_create"} -Get only group_create from the last thirty days -.Example +Get only group_create from the last thirty days +.Example PS C:\> Get-JCEvent -Service:('all') -StartTime:('2020-04-14T00:00:00Z') -EndTime:('2020-04-20T23:00:00Z') -SearchTermOr @{"initiated_by.username" = @("user.1", "user.2")} -Get login events initiated by either "user.1" or "user.2" between a universal time zone range -.Example +Get login events initiated by either "user.1" or "user.2" between a universal time zone range +.Example PS C:\> Get-JCEvent -Service:('all') -StartTime:('2020-04-14T00:00:00Z') -EndTime:('2020-04-20T23:00:00Z') -SearchTermAnd @{"event_type" = "admin_login_attempt"; "resource.email" = "admin.user@adminbizorg.com"} -Get all events between a date range and match event_type = admin_login_attempt and resource.email = admin.user@adminbizorg.com -.Example +Get all events between a date range and match event_type = admin_login_attempt and resource.email = admin.user@adminbizorg.com +.Example PS C:\> Get-JCEvent -Service:('sso') -StartTime:('2020-04-14T00:00:00Z') -EndTime:('2020-04-20T23:00:00Z') -SearchTermAnd @{"initiated_by.username" = "user.1"} -Get sso events with the search term initiated_by: username with value "user.1" -.Example +Get sso events with the search term initiated_by: username with value "user.1" +.Example PS C:\> Get-JCEvent -Service:('all') -StartTime:('2020-04-14T00:00:00Z') -EndTime:('2020-04-20T23:00:00Z') -SearchTermAnd @{"event_type" = "organization_update"} -Get all events filtered by organization_update term between a date range +Get all events filtered by organization_update term between a date range .Inputs JumpCloud.SDK.DirectoryInsights.Models.IEventQuery @@ -54,17 +54,19 @@ COMPLEX PARAMETER PROPERTIES To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. BODY : EventQuery is the users' command to search our auth logs - Service : service name to query. + Service >: service name to query. StartTime : query start time, UTC in RFC3339 format [EndTime ]: optional query end time, UTC in RFC3339 format - [Fields ]: optional list of fields to return from query + [ExactMatch ]: optional string for specifying exact match query, do not use with full text query + [Fields >]: optional list of fields to return from query [Limit ]: Max number of rows to return [Q ]: optional string for specifying a full text query - [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. [SearchTermNot ]: 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 [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 + [Skip ]: optional offset into the result set to start with when returning [Sort ]: ASC or DESC order for timestamp .Link https://github.com/TheJumpCloud/jcapi-powershell/tree/master/SDKs/PowerShell/JumpCloud.SDK.DirectoryInsights/docs/exports/Get-JcSdkEvent.md @@ -92,6 +94,12 @@ Function Get-JCEvent { # optional query end time, UTC in RFC3339 format ${EndTime}, + [Parameter(ParameterSetName='GetExpanded')] + [JumpCloud.SDK.DirectoryInsights.Category('Body')] + [System.String] + # optional string for specifying exact match query, do not use with full text query + ${ExactMatch}, + [Parameter(ParameterSetName='GetExpanded')] [AllowEmptyCollection()] [JumpCloud.SDK.DirectoryInsights.Category('Body')] @@ -149,7 +157,6 @@ Function Get-JCEvent { [JumpCloud.SDK.DirectoryInsights.Category('Body')] [JumpCloud.SDK.DirectoryInsights.Models.IEventQuery] # EventQuery is the users' command to search our auth logs - # To construct, see NOTES section for BODY properties and create a hash table. ${Body} ) Begin { diff --git a/PowerShell/JumpCloud Module/Public/DirectoryInsights/Get-JCEventCount.ps1 b/PowerShell/JumpCloud Module/Public/DirectoryInsights/Get-JCEventCount.ps1 index d289da86f..3a09c0a26 100644 --- a/PowerShell/JumpCloud Module/Public/DirectoryInsights/Get-JCEventCount.ps1 +++ b/PowerShell/JumpCloud Module/Public/DirectoryInsights/Get-JCEventCount.ps1 @@ -11,50 +11,52 @@ Query the API for a count of matching events ``` curl -X POST 'https://api.jumpcloud.com/insights/directory/v1/events/count' -H 'Content-Type: application/json' -H 'x-api-key: REPLACE_KEY_VALUE' --data '{\"service\": [\"all\"], \"start_time\": \"2021-07-14T23:00:00Z\", \"end_time\": \"2021-07-28T14:00:00Z\", \"sort\": \"DESC\", \"fields\": [\"timestamp\", \"event_type\", \"initiated_by\", \"success\", \"client_ip\", \"provider\", \"organization\"]}' ``` -.Example +.Example PS C:\> Get-JCEventCount -Service:('all') -StartTime:((Get-date).AddDays(-30)) -Pull all event records from a specified time and count the results -.Example +Pull all event records from a specified time and count the results +.Example PS C:\> Get-JCEventCount -Service:('sso') -StartTime:('2020-04-14T00:00:00Z') -Pull all SSO event records from a specified time and count the results -.Example +Pull all SSO event records from a specified time and count the results +.Example PS C:\> Get-JCEventCount -Service:('all') -StartTime:('2020-04-14T00:00:00Z') -EndTime:('2020-04-20T23:00:00Z') -SearchTermAnd @{"event_type" = "admin_login_attempt"; "resource.email" = "admin.user@adminbizorg.com"} -Get all events counts between a date range and match event_type = admin_login_attempt and resource.email = admin.user@adminbizorg.com -.Example +Get all events counts between a date range and match event_type = admin_login_attempt and resource.email = admin.user@adminbizorg.com +.Example PS C:\> Get-JCEventCount -Service:('directory') -StartTime:((Get-date).AddDays(-30)) -searchTermAnd:@{"event_type" = "group_create"} -Get only group_create event counts the last thirty days +Get only group_create event counts the last thirty days .Inputs JumpCloud.SDK.DirectoryInsights.Models.IEventQuery .Outputs -System.Int64 +JumpCloud.SDK.DirectoryInsights.Models.IEventCount .Notes COMPLEX PARAMETER PROPERTIES To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. BODY : EventQuery is the users' command to search our auth logs - Service : service name to query. + Service >: service name to query. StartTime : query start time, UTC in RFC3339 format [EndTime ]: optional query end time, UTC in RFC3339 format - [Fields ]: optional list of fields to return from query + [ExactMatch ]: optional string for specifying exact match query, do not use with full text query + [Fields >]: optional list of fields to return from query [Limit ]: Max number of rows to return [Q ]: optional string for specifying a full text query - [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. [SearchTermNot ]: 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 [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 + [Skip ]: optional offset into the result set to start with when returning [Sort ]: ASC or DESC order for timestamp .Link https://github.com/TheJumpCloud/jcapi-powershell/tree/master/SDKs/PowerShell/JumpCloud.SDK.DirectoryInsights/docs/exports/Get-JcSdkEventCount.md #> Function Get-JCEventCount { - [OutputType([System.Int64])] + [OutputType([JumpCloud.SDK.DirectoryInsights.Models.IEventCount])] [CmdletBinding(DefaultParameterSetName='GetExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] Param( [Parameter(ParameterSetName='GetExpanded', Mandatory)] @@ -76,6 +78,12 @@ Function Get-JCEventCount { # optional query end time, UTC in RFC3339 format ${EndTime}, + [Parameter(ParameterSetName='GetExpanded')] + [JumpCloud.SDK.DirectoryInsights.Category('Body')] + [System.String] + # optional string for specifying exact match query, do not use with full text query + ${ExactMatch}, + [Parameter(ParameterSetName='GetExpanded')] [AllowEmptyCollection()] [JumpCloud.SDK.DirectoryInsights.Category('Body')] @@ -127,7 +135,6 @@ Function Get-JCEventCount { [JumpCloud.SDK.DirectoryInsights.Category('Body')] [JumpCloud.SDK.DirectoryInsights.Models.IEventQuery] # EventQuery is the users' command to search our auth logs - # To construct, see NOTES section for BODY properties and create a hash table. ${Body} ) Begin { diff --git a/PowerShell/JumpCloud Module/Public/Policies/New-JCPolicy.ps1 b/PowerShell/JumpCloud Module/Public/Policies/New-JCPolicy.ps1 index 0c580f579..84bcb89e3 100644 --- a/PowerShell/JumpCloud Module/Public/Policies/New-JCPolicy.ps1 +++ b/PowerShell/JumpCloud Module/Public/Policies/New-JCPolicy.ps1 @@ -25,7 +25,7 @@ function New-JCPolicy { [System.String] $Notes ) - DynamicParam { + dynamicparam { if ($PSBoundParameters["TemplateID"]) { $ParameterAttribute = New-Object System.Management.Automation.ParameterAttribute $ParameterAttribute.Mandatory = $false @@ -52,7 +52,7 @@ function New-JCPolicy { } } - if ($templateObject.objectMap -And ($PSBoundParameters["TemplateName"] -OR $PSBoundParameters["TemplateID"])) { + if ($templateObject.objectMap -and ($PSBoundParameters["TemplateName"] -or $PSBoundParameters["TemplateID"])) { $RuntimeParameterDictionary = New-Object System.Management.Automation.RuntimeDefinedParameterDictionary # Foreach key in the supplied config file: foreach ($key in $templateObject.objectMap) { @@ -85,12 +85,12 @@ function New-JCPolicy { $paramType = [system.object[]] } 'exclude' { - Continue + continue } 'multilist' { $paramType = [system.object[]] } - Default { + default { $paramType = 'string' } } @@ -132,7 +132,7 @@ function New-JCPolicy { $requiredSet = @('TemplateID', 'TemplateName', 'Name' , 'Values') foreach ($parameter in $paramterSet) { $parameterComparison = Compare-Object -ReferenceObject $requiredSet -DifferenceObject $parameter - if ($parameterComparison | Where-Object { ( $_.sideindicator -eq "=>") -And ($_.InputObject -ne "Notes") }) { + if ($parameterComparison | Where-Object { ( $_.sideindicator -eq "=>") -and ($_.InputObject -ne "Notes") }) { $DynamicParamSet = $true break } @@ -198,7 +198,7 @@ function New-JCPolicy { } $RegProperties | ForEach-Object { if ($_.Name -notin $ObjectProperties) { - Throw "Custom Registry Tables require a `"$($_.Name)`" data string. The following data types were found: $($ObjectProperties)" + throw "Custom Registry Tables require a `"$($_.Name)`" data string. The following data types were found: $($ObjectProperties)" } } # reg type validation @@ -298,7 +298,7 @@ function New-JCPolicy { $templateObject.objectMap[$i].value = $keyValue } } - Default { + default { $templateObject.objectMap[$i].value = $($keyValue) } } @@ -335,7 +335,7 @@ function New-JCPolicy { # User selects edit individual field elseif ($initialUserInput.fieldSelection -ne 'C' -or $initialUserInput.fieldSelection -ne 'A') { $updatedPolicyObject = Set-JCPolicyConfigField -templateObject $templateObject.objectMap -fieldIndex $initialUserInput.fieldSelection - Do { + do { # Hide option to edit all fields $userInput = Show-JCPolicyValues -policyObject $updatedPolicyObject -HideAll $true $updatedPolicyObject = Set-JCPolicyConfigField -templateObject $templateObject.objectMap -fieldIndex $userInput.fieldSelection @@ -372,7 +372,7 @@ function New-JCPolicy { 'x-org-id' = $env:JCOrgId 'content-type' = "application/json" } - $response = Invoke-RestMethod -Uri "https://console.jumpcloud.com/api/v2/policies/" -Method POST -Headers $headers -ContentType 'application/json' -Body $body + $response = Invoke-RestMethod -Uri "$global:JCUrlBasePath/api/v2/policies/" -Method POST -Headers $headers -ContentType 'application/json' -Body $body if ($response) { $response | Add-Member -MemberType NoteProperty -Name "templateID" -Value $response.template.id } diff --git a/PowerShell/JumpCloud Module/Public/Policies/PolicyGroupTemplates/Get-JCPolicyGroupTemplateMember.ps1 b/PowerShell/JumpCloud Module/Public/Policies/PolicyGroupTemplates/Get-JCPolicyGroupTemplateMember.ps1 index ce418a930..536cdfca2 100644 --- a/PowerShell/JumpCloud Module/Public/Policies/PolicyGroupTemplates/Get-JCPolicyGroupTemplateMember.ps1 +++ b/PowerShell/JumpCloud Module/Public/Policies/PolicyGroupTemplates/Get-JCPolicyGroupTemplateMember.ps1 @@ -1,4 +1,4 @@ -Function Get-JCPolicyGroupTemplateMember { +function Get-JCPolicyGroupTemplateMember { [CmdletBinding()] param ( [Parameter( @@ -40,10 +40,10 @@ Function Get-JCPolicyGroupTemplateMember { } catch { throw "Could not find policy group template with name: $name" } - "https://console.jumpcloud.com/api/v2/providers/$ProviderID/policygrouptemplates/$GroupTemplateID/members" + "$global:JCUrlBasePath/api/v2/providers/$ProviderID/policygrouptemplates/$GroupTemplateID/members" } "ById" { - "https://console.jumpcloud.com/api/v2/providers/$ProviderID/policygrouptemplates/$GroupTemplateID/members" + "$global:JCUrlBasePath/api/v2/providers/$ProviderID/policygrouptemplates/$GroupTemplateID/members" } } $response = Invoke-JCApi -Method:('Get') -Paginate:($true) -Url:($URL) diff --git a/PowerShell/JumpCloud Module/Public/Policies/PolicyGroups/Remove-JCPolicyGroup.ps1 b/PowerShell/JumpCloud Module/Public/Policies/PolicyGroups/Remove-JCPolicyGroup.ps1 index e28c25a75..04aeb3152 100644 --- a/PowerShell/JumpCloud Module/Public/Policies/PolicyGroups/Remove-JCPolicyGroup.ps1 +++ b/PowerShell/JumpCloud Module/Public/Policies/PolicyGroups/Remove-JCPolicyGroup.ps1 @@ -1,4 +1,4 @@ -Function Remove-JCPolicyGroup { +function Remove-JCPolicyGroup { [CmdletBinding()] param ( [Parameter( @@ -49,9 +49,9 @@ Function Remove-JCPolicyGroup { } } process { - if (-NOT [System.String]::IsNullOrEmpty($PolicyGroupID)) { - $URL = "https://console.jumpcloud.com/api/v2/policygroups/$PolicyGroupID" - if (-NOT $Force) { + if (-not [System.String]::IsNullOrEmpty($PolicyGroupID)) { + $URL = "$global:JCUrlBasePath/api/v2/policygroups/$PolicyGroupID" + if (-not $Force) { Write-Warning "Are you sure you wish to delete policy group: `'$($foundPolicy.Name)`'?" -WarningAction Inquire } try { diff --git a/PowerShell/JumpCloud Module/Public/Policies/PolicyGroups/Set-JCPolicyGroup.ps1 b/PowerShell/JumpCloud Module/Public/Policies/PolicyGroups/Set-JCPolicyGroup.ps1 index 06c190c71..1ad199ab7 100644 --- a/PowerShell/JumpCloud Module/Public/Policies/PolicyGroups/Set-JCPolicyGroup.ps1 +++ b/PowerShell/JumpCloud Module/Public/Policies/PolicyGroups/Set-JCPolicyGroup.ps1 @@ -1,4 +1,4 @@ -Function Set-JCPolicyGroup { +function Set-JCPolicyGroup { [CmdletBinding()] param ( [Parameter( @@ -56,7 +56,7 @@ Function Set-JCPolicyGroup { $foundPolicyGroup.Description } - $URL = "https://console.jumpcloud.com/api/v2/policygroups/$($foundPolicyGroup.id)" + $URL = "$global:JCUrlBasePath/api/v2/policygroups/$($foundPolicyGroup.id)" $BODY = @{ name = "$NameFromProcess" description = "$DescriptionFromProcess" diff --git a/PowerShell/JumpCloud Module/Public/Policies/Set-JCPolicy.ps1 b/PowerShell/JumpCloud Module/Public/Policies/Set-JCPolicy.ps1 index aea7b3322..5e18474c8 100644 --- a/PowerShell/JumpCloud Module/Public/Policies/Set-JCPolicy.ps1 +++ b/PowerShell/JumpCloud Module/Public/Policies/Set-JCPolicy.ps1 @@ -28,7 +28,7 @@ function Set-JCPolicy { [System.String] $Notes ) - DynamicParam { + dynamicparam { if ($PSBoundParameters["PolicyID"]) { $ParameterAttribute = New-Object System.Management.Automation.ParameterAttribute @@ -57,7 +57,7 @@ function Set-JCPolicy { } } # If policy is identified, get the dynamic policy set - if ($foundPolicy.id -And ($PSBoundParameters["PolicyName"] -OR $PSBoundParameters["PolicyID"])) { + if ($foundPolicy.id -and ($PSBoundParameters["PolicyName"] -or $PSBoundParameters["PolicyID"])) { # Set the policy template object based on policy $templateObject = Get-JCPolicyTemplateConfigField -templateID $foundPolicy.Template.Id $RuntimeParameterDictionary = New-Object System.Management.Automation.RuntimeDefinedParameterDictionary @@ -95,9 +95,9 @@ function Set-JCPolicy { $paramType = [system.object[]] } 'exclude' { - Continue + continue } - Default { + default { $paramType = 'string' } } @@ -145,7 +145,7 @@ function Set-JCPolicy { } process { # Get Existing Policy Data if not set through dynamic param - if (([string]::IsNullOrEmpty($foundPolicy.ID)) -And ($policyID)) { + if (([string]::IsNullOrEmpty($foundPolicy.ID)) -and ($policyID)) { # Get the policy by ID $foundPolicy = Get-JCPolicy -PolicyID $PolicyID if ([string]::IsNullOrEmpty($foundPolicy.ID)) { @@ -168,15 +168,15 @@ function Set-JCPolicy { $requiredSet = @('PolicyID', 'PolicyName', 'NewName' , 'Values') foreach ($parameter in $paramterSet) { $parameterComparison = Compare-Object -ReferenceObject $requiredSet -DifferenceObject $parameter - if ($parameterComparison | Where-Object { ( $_.sideindicator -eq "=>") -And ($_.InputObject -ne "Notes") }) { + if ($parameterComparison | Where-Object { ( $_.sideindicator -eq "=>") -and ($_.InputObject -ne "Notes") }) { $DynamicParamSet = $true break } } # only update newName or Notes: - if ((("NewName" -in $params.keys) -AND ("Values" -notin $params.Keys)) -OR - (("Notes" -in $params.keys) -AND ("Values" -notin $params.Keys))) { + if ((("NewName" -in $params.keys) -and ("Values" -notin $params.Keys)) -or + (("Notes" -in $params.keys) -and ("Values" -notin $params.Keys))) { $Values = $foundPolicy.values } # get the notes if it's not in the param set @@ -233,7 +233,7 @@ function Set-JCPolicy { } $RegProperties | ForEach-Object { if ($_.Name -notin $ObjectProperties) { - Throw "Custom Registry Tables require a `"$($_.Name)`" data string. The following data types were found: $($ObjectProperties)" + throw "Custom Registry Tables require a `"$($_.Name)`" data string. The following data types were found: $($ObjectProperties)" } } # reg type validation @@ -262,7 +262,7 @@ function Set-JCPolicy { } $uriListProperties | ForEach-Object { if ($_.Name -notin $ObjectProperties) { - Throw "Custom Windows MDM Policy require a `"$($_.Name)`" data string. The following data types were found: $($ObjectProperties)" + throw "Custom Windows MDM Policy require a `"$($_.Name)`" data string. The following data types were found: $($ObjectProperties)" } } # uriList type validation @@ -350,7 +350,7 @@ function Set-JCPolicy { $templateObject.objectMap[$i].value = $keyValue } } - Default { + default { $templateObject.objectMap[$i].value = $($keyValue) } } @@ -423,7 +423,7 @@ function Set-JCPolicy { $_ | Add-Member -MemberType NoteProperty -Name "label" -Value $templateObject.objectMap[$templateObject.objectMap.configFieldID.IndexOf($($_.configFieldID))].label } } - Do { + do { # Hide option to edit all fields $userInput = Show-JCPolicyValues -policyObject $updatedPolicyObject -HideAll $true -policyValues $foundPolicy.values $updatedPolicyObject = Set-JCPolicyConfigField -templateObject $templateObject.objectMap -fieldIndex $userInput.fieldSelection -policyValues $foundPolicy.values @@ -451,7 +451,7 @@ function Set-JCPolicy { 'x-org-id' = $env:JCOrgId 'content-type' = "application/json" } - $response = Invoke-RestMethod -Uri "https://console.jumpcloud.com/api/v2/policies/$($foundPolicy.id)" -Method PUT -Headers $headers -ContentType 'application/json' -Body $body + $response = Invoke-RestMethod -Uri "$global:JCUrlBasePath/api/v2/policies/$($foundPolicy.id)" -Method PUT -Headers $headers -ContentType 'application/json' -Body $body if ($response) { $response | Add-Member -MemberType NoteProperty -Name "templateID" -Value $response.template.id } diff --git a/PowerShell/JumpCloud Module/Public/Reports/Get-JCReport.ps1 b/PowerShell/JumpCloud Module/Public/Reports/Get-JCReport.ps1 index c2fe0e51b..17756c60a 100644 --- a/PowerShell/JumpCloud Module/Public/Reports/Get-JCReport.ps1 +++ b/PowerShell/JumpCloud Module/Public/Reports/Get-JCReport.ps1 @@ -17,14 +17,12 @@ JumpCloud.SDK.DirectoryInsights.Models.IGet200ApplicationJsonItemsItem .Link https://github.com/TheJumpCloud/jcapi-powershell/tree/master/SDKs/PowerShell/JumpCloud.SDK.DirectoryInsights/docs/exports/Get-JcSdkReport.md #> -Function Get-JCReport { +function Get-JCReport { [OutputType([JumpCloud.SDK.DirectoryInsights.Models.IGet200ApplicationJsonItemsItem])] [CmdletBinding(DefaultParameterSetName = 'List', PositionalBinding = $false)] - Param( + param( [Parameter()] - [ArgumentCompleter([JumpCloud.SDK.DirectoryInsights.Support.Sort])] [JumpCloud.SDK.DirectoryInsights.Category('Query')] - [JumpCloud.SDK.DirectoryInsights.Support.Sort] # Sort type and direction. # Default sort is descending, prefix with - to sort ascending. ${Sort}, @@ -35,7 +33,7 @@ Function Get-JCReport { [ValidateSet('json', 'csv')] [String]$Type ) - Begin { + begin { Connect-JCOnline -force | Out-Null $Results = @() $headers = @{ @@ -44,7 +42,7 @@ Function Get-JCReport { "x-org-id" = $Env:JCOrgId } } - Process { + process { switch ($PSCmdlet.ParameterSetName) { List { $Results = JumpCloud.SDK.DirectoryInsights\Get-JcSdkReport @PSBoundParameters @@ -93,12 +91,16 @@ Function Get-JCReport { if ($ReportGenerationFailure -eq $true) { $Results = $Report } else { - $Results = Invoke-RestMethod -Uri "https://api.jumpcloud.com/insights/directory/v1/reports/$reportID/artifacts/$artifactID/content" -Method GET -Headers $headers + if ($global:JCEnvironment -eq 'EU') { + $Results = Invoke-RestMethod -Uri "https://api.eu.jumpcloud.com/insights/directory/v1/reports/$reportID/artifacts/$artifactID/content" -Method GET -Headers $headers + } else { + $Results = Invoke-RestMethod -Uri "https://api.jumpcloud.com/insights/directory/v1/reports/$reportID/artifacts/$artifactID/content" -Method GET -Headers $headers + } } } } } - End { - Return $Results + end { + return $Results } } diff --git a/PowerShell/JumpCloud Module/Public/Reports/New-JCReport.ps1 b/PowerShell/JumpCloud Module/Public/Reports/New-JCReport.ps1 index d70dbb984..3e15b17e6 100644 --- a/PowerShell/JumpCloud Module/Public/Reports/New-JCReport.ps1 +++ b/PowerShell/JumpCloud Module/Public/Reports/New-JCReport.ps1 @@ -26,14 +26,12 @@ INPUTOBJECT : Identity Parameter .Link https://github.com/TheJumpCloud/jcapi-powershell/tree/master/SDKs/PowerShell/JumpCloud.SDK.DirectoryInsights/docs/exports/New-JcSdkReport.md #> -Function New-JCReport { +function New-JCReport { [OutputType([JumpCloud.SDK.DirectoryInsights.Models.IPathsE6Q3GdReportsReportTypePostResponses202ContentApplicationJsonSchema])] [CmdletBinding(DefaultParameterSetName = 'Create', PositionalBinding = $false, SupportsShouldProcess, ConfirmImpact = 'Medium')] - Param( + param( [Parameter(ParameterSetName = 'Create', Mandatory)] - [ArgumentCompleter([JumpCloud.SDK.DirectoryInsights.Support.ReportType1])] [JumpCloud.SDK.DirectoryInsights.Category('Path')] - [JumpCloud.SDK.DirectoryInsights.Support.ReportType1] [ValidateSet("browser-patch-policy", "os-patch-policy", "users-to-devices", "users-to-directories", "users-to-ldap-servers", "users-to-radius-servers", "users-to-sso-applications", "users-to-user-groups")] # Report Type ${ReportType}, @@ -45,14 +43,14 @@ Function New-JCReport { # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject} ) - Begin { + begin { Connect-JCOnline -force | Out-Null $Results = @() } - Process { + process { $Results = JumpCloud.SDK.DirectoryInsights\New-JcSdkReport @PSBoundParameters } - End { - Return $Results + end { + return $Results } } diff --git a/PowerShell/JumpCloud Module/Public/Systems/Get-JCSystem.ps1 b/PowerShell/JumpCloud Module/Public/Systems/Get-JCSystem.ps1 index f42347bde..2628f9a21 100644 --- a/PowerShell/JumpCloud Module/Public/Systems/Get-JCSystem.ps1 +++ b/PowerShell/JumpCloud Module/Public/Systems/Get-JCSystem.ps1 @@ -1,4 +1,4 @@ -Function Get-JCSystem () { +function Get-JCSystem () { [CmdletBinding(DefaultParameterSetName = 'SearchFilter')] param @@ -153,12 +153,12 @@ Function Get-JCSystem () { ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', HelpMessage = 'Allows you to return select properties on JumpCloud system 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: ''created'', ''active'', ''agentVersion'', ''allowMultiFactorAuthentication'', ''allowPublicKeyAuthentication'', ''allowSshPasswordAuthentication'', ''allowSshRootLogin'', ''arch'', ''created'', ''displayName'', ''hostname'', ''lastContact'', ''modifySSHDConfig'', ''organization'', ''os'', ''remoteIP'', ''serialNumber'', ''sshdParams'', ''systemTimezone'', ''templateName'', ''version'', ''hwVendor'',''secureLogin'',''displayManager'',''amazonInstanceID'',''archFamily'',''builtInCommands'',''description'',''osVersionDetail'',''policyStats'',''desktopCapable'', ''sshRootEnabled'', ''agentHasFullDiskAccess''')] - [ValidateSet('acknowledged', 'active', 'agentVersion', 'allowMultiFactorAuthentication', 'allowPublicKeyAuthentication', 'allowSshPasswordAuthentication', 'allowSshRootLogin', 'arch', 'azureAdJoined', 'connectionHistory', 'created', 'displayName', 'domainInfo', 'fde', 'fileSystem', 'hasServiceAccount', 'hostname', 'lastContact', 'mdm', 'modifySSHDConfig', 'networkInterfaces', 'organization', 'os', 'osFamily', 'primarySystemUser', 'provisionMetadata', 'remoteAssistAgentVersion', 'remoteIP', 'serialNumber', 'serviceAccountState', 'sshdParams', 'systemInsights', 'systemTimezone', 'templateName', 'userMetrics', 'usernameHashes', 'version', 'hwVendor', 'secureLogin', 'displayManager', 'amazonInstanceID', 'archFamily', 'builtInCommands', 'description', 'osVersionDetail', 'policyStats', 'desktopCapable', 'sshRootEnabled', 'isPolicyBound', 'agentHasFullDiskAccess')] + [ValidateSet('acknowledged', 'active', 'agentVersion', 'allowMultiFactorAuthentication', 'allowPublicKeyAuthentication', 'allowSshPasswordAuthentication', 'allowSshRootLogin', 'arch', 'attributes', 'azureAdJoined', 'connectionHistory', 'created', 'displayName', 'domainInfo', 'fde', 'fileSystem', 'hasServiceAccount', 'hostname', 'lastContact', 'mdm', 'modifySSHDConfig', 'networkInterfaces', 'organization', 'os', 'osFamily', 'primarySystemUser', 'provisionMetadata', 'remoteAssistAgentVersion', 'remoteIP', 'serialNumber', 'serviceAccountState', 'sshdParams', 'systemInsights', 'systemTimezone', 'templateName', 'userMetrics', 'usernameHashes', 'version', 'hwVendor', 'secureLogin', 'displayManager', 'amazonInstanceID', 'archFamily', 'builtInCommands', 'description', 'osVersionDetail', 'policyStats', 'desktopCapable', 'sshRootEnabled', 'isPolicyBound', 'agentHasFullDiskAccess')] [String[]]$returnProperties ) - DynamicParam { - If ((Get-PSCallStack).Command -like '*MarkdownHelp') { + dynamicparam { + if ((Get-PSCallStack).Command -like '*MarkdownHelp') { $filterDateProperty = 'created' } if ($filterDateProperty) { @@ -444,7 +444,7 @@ Function Get-JCSystem () { $pipelineLength, $functions = Get-PipelineDetails -line $MyInvocation.Line $setAfterGet = Get-PipelinePositionBefore -before "Get-JCSystem" -after "Set-JCSystem" -functionArray $functions if ($pipelineLength -gt 1) { - if (($resultsArrayList.Count -ne 0) -And ($setAfterGet -eq $true)) { + if (($resultsArrayList.Count -ne 0) -and ($setAfterGet -eq $true)) { foreach ($item in $resultsArrayList) { $itemSysInsightsState = switch ($item.systemInsights.state) { 'enabled' { diff --git a/PowerShell/JumpCloud Module/Public/Utilities/CSV_Import/Import-JCMSPFromCSV.ps1 b/PowerShell/JumpCloud Module/Public/Utilities/CSV_Import/Import-JCMSPFromCSV.ps1 index c150b7c8c..d3c7b9aca 100644 --- a/PowerShell/JumpCloud Module/Public/Utilities/CSV_Import/Import-JCMSPFromCSV.ps1 +++ b/PowerShell/JumpCloud Module/Public/Utilities/CSV_Import/Import-JCMSPFromCSV.ps1 @@ -1,4 +1,4 @@ -Function Import-JCMSPFromCSV () { +function Import-JCMSPFromCSV () { [CmdletBinding(DefaultParameterSetName = 'GUI')] param ( @@ -57,7 +57,7 @@ Function Import-JCMSPFromCSV () { $orgDup = $orgNameCheck | Group-Object Name - ForEach ($U in $orgDup) { + foreach ($U in $orgDup) { if ($U.count -gt 1) { Write-Host "Organization: $($U.Name) is duplicated in import file." throw "Duplicate organization name: $($U.Name) in import file. organiztion name already exists." @@ -77,7 +77,7 @@ Function Import-JCMSPFromCSV () { if ([System.String]::IsNullOrEmpty($JCAPIKEY)) { Connect-JCOnline } - if (-Not $Env:JCProviderID) { + if (-not $Env:JCProviderID) { $PID = Read-Host "Please enter your Provider ID" $Env:JCProviderID = $PID } @@ -92,7 +92,7 @@ Function Import-JCMSPFromCSV () { MSP Update "@ - If (!(Get-PSCallStack | Where-Object { $_.Command -match 'Pester' })) { + if (!(Get-PSCallStack | Where-Object { $_.Command -match 'Pester' })) { Clear-Host } } @@ -163,8 +163,8 @@ Function Import-JCMSPFromCSV () { if ($response) { Clear-Variable -Name response } - Try { - $response = Invoke-RestMethod -Uri "https://console.jumpcloud.com/api/v2/providers/$($ENV:JCProviderID)/organizations" -Method POST -Headers $headers -ContentType 'application/json' -Body $body -ErrorVariable errMsg + try { + $response = Invoke-RestMethod -Uri "$global:JCUrlBasePath/api/v2/providers/$($ENV:JCProviderID)/organizations" -Method POST -Headers $headers -ContentType 'application/json' -Body $body -ErrorVariable errMsg # Add to result array $ResultsArrayList.Add( [PSCustomObject]@{ @@ -174,7 +174,7 @@ Function Import-JCMSPFromCSV () { 'status' = 'Imported' }) | Out-Null } catch { - If ($errMsg.Message) { + if ($errMsg.Message) { $Status = $errMsg.Message } elseif ($errMsg.ErrorDetails) { $Status = $errMsg.ErrorDetails diff --git a/PowerShell/JumpCloud Module/Public/Utilities/CSV_Import/New-JCMSPImportTemplate.ps1 b/PowerShell/JumpCloud Module/Public/Utilities/CSV_Import/New-JCMSPImportTemplate.ps1 index a41c51a1d..be6fe1574 100644 --- a/PowerShell/JumpCloud Module/Public/Utilities/CSV_Import/New-JCMSPImportTemplate.ps1 +++ b/PowerShell/JumpCloud Module/Public/Utilities/CSV_Import/New-JCMSPImportTemplate.ps1 @@ -1,4 +1,4 @@ -Function New-JCMSPImportTemplate() { +function New-JCMSPImportTemplate() { [CmdletBinding()] param @@ -83,7 +83,7 @@ Function New-JCMSPImportTemplate() { $ConfirmUpdateVsNew = 'N' } elseif ($type -eq 'Update') { $ConfirmUpdateVsNew = 'U' - } Else { + } else { # PromptForChoice Args $Title = "Do you want to create an import CSV template for creating new MSP orgs or updating existing MSP orgs?" @@ -130,9 +130,9 @@ Function New-JCMSPImportTemplate() { $skip = 0 $limit = 10 - Do { + do { # get results - $response = Invoke-RestMethod -Uri "https://console.jumpcloud.com/api/organizations?limit=$($limit)&skip=$($skip)&sortIgnoreCase=settings.name&fields%5B0%5D=id&fields%5B1%5D=displayName&fields%5B2%5D=systemsCount&fields%5B3%5D=systemUsersCount&fields%5B4%5D=highWaterMarkLastMonth&fields%5B5%5D=entitlement&fields%5B6%5D=maxSystemUsers" -Method GET -Headers $orgHeaders + $response = Invoke-RestMethod -Uri "$global:JCUrlBasePath/api/organizations?limit=$($limit)&skip=$($skip)&sortIgnoreCase=settings.name&fields%5B0%5D=id&fields%5B1%5D=displayName&fields%5B2%5D=systemsCount&fields%5B3%5D=systemUsersCount&fields%5B4%5D=highWaterMarkLastMonth&fields%5B5%5D=entitlement&fields%5B6%5D=maxSystemUsers" -Method GET -Headers $orgHeaders # add results to the ExistingOrgs foreach ($item in $response.results) { @@ -169,24 +169,24 @@ Function New-JCMSPImportTemplate() { if ($PSCmdlet.ParameterSetName -eq 'force') { if (!$ExportPath ) { Write-Host "" - $CSV | Export-Csv -path "$ExportLocation/$FileName" -NoTypeInformation - Write-Host 'Creating file ' -NoNewline + $CSV | Export-Csv -Path "$ExportLocation/$FileName" -NoTypeInformation + Write-Host 'Creating file ' -NoNewline Write-Host $FileName -ForegroundColor Yellow -NoNewline Write-Host ' in the location' -NoNewline Write-Host " $ExportLocation" -ForegroundColor Yellow } else { Write-Warning "The file $fileName already exists, overwriting..." - $CSV | Export-Csv -path "$ExportLocation/$FileName" -NoTypeInformation - Write-Host 'Creating file ' -NoNewline + $CSV | Export-Csv -Path "$ExportLocation/$FileName" -NoTypeInformation + Write-Host 'Creating file ' -NoNewline Write-Host $FileName -ForegroundColor Yellow -NoNewline Write-Host ' in the location' -NoNewline Write-Host " $ExportLocation" -ForegroundColor Yellow } - } Else { + } else { if (!$ExportPath ) { Write-Host "" - $CSV | Export-Csv -path "$ExportLocation/$FileName" -NoTypeInformation - Write-Host 'Creating file' -NoNewline + $CSV | Export-Csv -Path "$ExportLocation/$FileName" -NoTypeInformation + Write-Host 'Creating file' -NoNewline Write-Host " $fileName" -ForegroundColor Yellow -NoNewline Write-Host ' in the location' -NoNewline Write-Host " $ExportLocation" -ForegroundColor Yellow @@ -194,8 +194,8 @@ Function New-JCMSPImportTemplate() { Write-Host "" Write-Warning "The file $fileName already exists do you want to overwrite it?" -WarningAction Inquire Write-Host "" - $CSV | Export-Csv -path "$ExportLocation/$FileName" -NoTypeInformation - Write-Host 'Creating file ' -NoNewline + $CSV | Export-Csv -Path "$ExportLocation/$FileName" -NoTypeInformation + Write-Host 'Creating file ' -NoNewline Write-Host $FileName -ForegroundColor Yellow -NoNewline Write-Host ' in the location' -NoNewline Write-Host " $ExportLocation" -ForegroundColor Yellow @@ -217,7 +217,7 @@ Function New-JCMSPImportTemplate() { # Action based on the choice switch ($Choice) { 0 { - Invoke-Item -path "$ExportLocation/$FileName" + Invoke-Item -Path "$ExportLocation/$FileName" } 1 { $ConfirmUpdateVsNew = 'U' diff --git a/PowerShell/JumpCloud Module/Public/Utilities/CSV_Import/Update-JCMSPFromCSV.ps1 b/PowerShell/JumpCloud Module/Public/Utilities/CSV_Import/Update-JCMSPFromCSV.ps1 index c66debe69..b47db39f0 100644 --- a/PowerShell/JumpCloud Module/Public/Utilities/CSV_Import/Update-JCMSPFromCSV.ps1 +++ b/PowerShell/JumpCloud Module/Public/Utilities/CSV_Import/Update-JCMSPFromCSV.ps1 @@ -1,4 +1,4 @@ -Function Update-JCMSPFromCSV () { +function Update-JCMSPFromCSV () { [CmdletBinding(DefaultParameterSetName = 'GUI')] param ( @@ -61,7 +61,7 @@ Function Update-JCMSPFromCSV () { # check for duplicate orgs $orgDup = $orgNameCheck | Group-Object Name - ForEach ($U in $orgDup) { + foreach ($U in $orgDup) { if ($U.count -gt 1) { Write-Host "Organization: $($U.Name) is duplicated in update file." throw "Duplicate organization name: $($U.Name) in update file. organiztion name already exists." @@ -81,7 +81,7 @@ Function Update-JCMSPFromCSV () { if ([System.String]::IsNullOrEmpty($JCAPIKEY)) { Connect-JCOnline } - if (-Not $Env:JCProviderID) { + if (-not $Env:JCProviderID) { $PID = Read-Host "Please enter your Provider ID" $Env:JCProviderID = $PID } @@ -96,7 +96,7 @@ Function Update-JCMSPFromCSV () { MSP Update "@ - If (!(Get-PSCallStack | Where-Object { $_.Command -match 'Pester' })) { + if (!(Get-PSCallStack | Where-Object { $_.Command -match 'Pester' })) { Clear-Host } } @@ -110,7 +110,7 @@ Function Update-JCMSPFromCSV () { Write-Host $Banner -ForegroundColor Green Write-Host "" - Write-host "Update Summary:" + Write-Host "Update Summary:" $orgNameCheck | Format-Table # PromptForChoice Args @@ -167,8 +167,8 @@ Function Update-JCMSPFromCSV () { if ($response) { Clear-Variable -Name response } - Try { - $response = Invoke-RestMethod -Uri "https://console.jumpcloud.com/api/v2/providers/$($ENV:JCProviderID)/organizations/$($OrgUpdate.id)" -Method PUT -Headers $headers -ContentType 'application/json' -Body $body -ErrorVariable errMsg + try { + $response = Invoke-RestMethod -Uri "$global:JCUrlBasePath/api/v2/providers/$($ENV:JCProviderID)/organizations/$($OrgUpdate.id)" -Method PUT -Headers $headers -ContentType 'application/json' -Body $body -ErrorVariable errMsg # Add to result array $ResultsArrayList.Add( [PSCustomObject]@{ @@ -178,7 +178,7 @@ Function Update-JCMSPFromCSV () { 'status' = 'Updated' }) | Out-Null } catch { - If ($errMsg.Message) { + if ($errMsg.Message) { $Status = $errMsg.Message } elseif ($errMsg.ErrorDetails) { $Status = $errMsg.ErrorDetails diff --git a/PowerShell/JumpCloud Module/Public/settings/Set-JCSettingsFile.ps1 b/PowerShell/JumpCloud Module/Public/settings/Set-JCSettingsFile.ps1 index 27b43932b..c12093970 100644 --- a/PowerShell/JumpCloud Module/Public/settings/Set-JCSettingsFile.ps1 +++ b/PowerShell/JumpCloud Module/Public/settings/Set-JCSettingsFile.ps1 @@ -2,11 +2,11 @@ function Set-JCSettingsFile { [CmdletBinding()] param ( ) - DynamicParam { + dynamicparam { $ModuleRoot = (Get-Item -Path:($PSScriptRoot)).Parent.Parent.FullName - $configFilePath = join-path -path $ModuleRoot -childpath 'Config.json' + $configFilePath = Join-Path -Path $ModuleRoot -ChildPath 'Config.json' - if (test-path -path $configFilePath) { + if (Test-Path -Path $configFilePath) { $config = Get-Content -Path $configFilePath | ConvertFrom-Json # Create the dictionary $RuntimeParameterDictionary = New-Object System.Management.Automation.RuntimeDefinedParameterDictionary @@ -51,15 +51,11 @@ function Set-JCSettingsFile { } } begin { - if ([System.String]::IsNullOrEmpty($JCAPIKEY)) { - Connect-JCOnline -Force | Out-Null - } - # Config should be in /PowerShell/JumpCloudModule/Config.json $ModuleRoot = (Get-Item -Path:($PSScriptRoot)).Parent.Parent.FullName - $configFilePath = join-path -path $ModuleRoot -childpath 'Config.json' + $configFilePath = Join-Path -Path $ModuleRoot -ChildPath 'Config.json' - if (test-path -path $configFilePath) { + if (Test-Path -Path $configFilePath) { $config = Get-Content -Path $configFilePath | ConvertFrom-Json } else { New-JCSettingsFile @@ -81,13 +77,17 @@ function Set-JCSettingsFile { } } # Re-Calculate Parallel Settings: - if (($config.'parallel'.'Override' -eq $true) -And (($config.'parallel'.'Eligible' -eq $true))) { + if (($config.'parallel'.'Override' -eq $true) -and (($config.'parallel'.'Eligible' -eq $true))) { $config.'parallel'.'Calculated' = $false - } elseif (($config.'parallel'.'Override'.'value' -eq $false) -And (($config.'parallel'.'Eligible'.'value' -eq $true))) { + } elseif (($config.'parallel'.'Override'.'value' -eq $false) -and (($config.'parallel'.'Eligible'.'value' -eq $true))) { $config.'parallel'.'Calculated'.'value' = $true } else { $config.'parallel'.'Calculated'.'value' = $false } + + # Set the env variable for JCEnvironment + $env:JCEnvironment = $config.'JCEnvironment'.'Location'.value + $global:JCEnvironment = $env:JCEnvironment } end { diff --git a/PowerShell/JumpCloud Module/Tests/HelperFunctions.ps1 b/PowerShell/JumpCloud Module/Tests/HelperFunctions.ps1 index ce63adfd6..99a7d522d 100755 --- a/PowerShell/JumpCloud Module/Tests/HelperFunctions.ps1 +++ b/PowerShell/JumpCloud Module/Tests/HelperFunctions.ps1 @@ -1,4 +1,4 @@ -Function New-RandomString () { +function New-RandomString () { [CmdletBinding()] param( @@ -13,11 +13,11 @@ Function New-RandomString () { process { $Random = -join ((65..90) + (97..122) | Get-Random -Count $NumberOfChars | ForEach-Object { [char]$_ }) } - end { Return $Random } + end { return $Random } } -Function New-RandomUser () { +function New-RandomUser () { [CmdletBinding(DefaultParameterSetName = 'NoAttributes')] param ( @@ -70,7 +70,7 @@ Function New-RandomUser () { return $NewRandomUser } -Function New-RandomUserCustom () { +function New-RandomUserCustom () { [CmdletBinding(DefaultParameterSetName = 'NoAttributes')] param ( @@ -123,7 +123,7 @@ Function New-RandomUserCustom () { return $NewRandomUser } -Function New-RandomStringLower () { +function New-RandomStringLower () { [CmdletBinding()] param( @@ -137,7 +137,7 @@ Function New-RandomStringLower () { process { $Random = -join ((65..90) + (97..122) | Get-Random -Count $NumberOfChars | ForEach-Object { [char]$_ }) } - end { Return $Random.ToLower() } + end { return $Random.ToLower() } } function Create-RadiusServerTryCatch { diff --git a/PowerShell/JumpCloud Module/Tests/ModuleValidation/FunctionFiles.Tests.ps1 b/PowerShell/JumpCloud Module/Tests/ModuleValidation/FunctionFiles.Tests.ps1 index 796939d61..4b79b2b59 100755 --- a/PowerShell/JumpCloud Module/Tests/ModuleValidation/FunctionFiles.Tests.ps1 +++ b/PowerShell/JumpCloud Module/Tests/ModuleValidation/FunctionFiles.Tests.ps1 @@ -1,5 +1,5 @@ Describe -Tag:('ModuleValidation') 'Function Format Tests' { - Function Get-FunctionReportTestCases { + function Get-FunctionReportTestCases { $ModuleRoot = (Get-Item -Path:($PSScriptRoot)).Parent.Parent.FullName $FunctionList = Get-FunctionReport -Folder:(("$ModuleRoot/Public"), ("$ModuleRoot/Private")) | Where-Object { $_.FileName -notlike 'ScriptBlock_*' } $FunctionListTestCases = $FunctionList | ForEach-Object { @@ -14,7 +14,7 @@ Describe -Tag:('ModuleValidation') 'Function Format Tests' { FullName = $_.FullName } } - Return $FunctionListTestCases; + return $FunctionListTestCases; } Context ('Test that the file name matches the function name') { It ('When FileBaseName "" equal Function "" for file ""') -TestCases:(Get-FunctionReportTestCases) { @@ -37,7 +37,7 @@ Describe -Tag:('ModuleValidation') 'Function Format Tests' { } Context ('Test that Connect-JCOnline exists in each Public function') { It ('When FileName "" does not contain "Connect-JCOnline"') -TestCases:(Get-FunctionReportTestCases) { - If ($FolderLocation -eq 'Public' -and $FileName -notin ('New-JCDeploymentTemplate.ps1', 'Update-JCModule.ps1')) { + if ($FolderLocation -eq 'Public' -and $FileName -notin ('Set-JCSettingsFile.ps1', 'New-JCDeploymentTemplate.ps1', 'Update-JCModule.ps1')) { ($Content | Select-String -Pattern:('(?i)(Connect-JCOnline)')) | Should -Not -BeNullOrEmpty } } @@ -49,7 +49,7 @@ Describe -Tag:('ModuleValidation') 'Function Format Tests' { It ('When multiple functions with the same name exist for ""') -TestCases:(Get-FunctionReportTestCases) { ($Function | Group-Object).Count | Should -Be 1 } - It ('When multiple MatchValues of functions with the same name exist for ""') -TestCases:(Get-FunctionReportTestCases) { + It ('When multiple MatchValues of functions with the same name exist for ""') -TestCases:(Get-FunctionReportTestCases) { ($MatchValue | Group-Object).Count | Should -Be 1 } } diff --git a/PowerShell/JumpCloud Module/Tests/ModuleValidation/HelpFiles.Tests.ps1 b/PowerShell/JumpCloud Module/Tests/ModuleValidation/HelpFiles.Tests.ps1 index b06effc73..ba65a438e 100755 --- a/PowerShell/JumpCloud Module/Tests/ModuleValidation/HelpFiles.Tests.ps1 +++ b/PowerShell/JumpCloud Module/Tests/ModuleValidation/HelpFiles.Tests.ps1 @@ -1,5 +1,5 @@ Describe -Tag:('ModuleValidation') 'Help File Tests' { - Function Get-HelpFilesTestCases { + function Get-HelpFilesTestCases { $ModuleRoot = (Get-Item -Path:($PSScriptRoot)).Parent.Parent $ModuleRootFullName = $ModuleRoot.FullName $Regex_FillInThe = '(\{\{)(.*?)(\}\})' @@ -14,11 +14,11 @@ Describe -Tag:('ModuleValidation') 'Help File Tests' { Regex_FillInThePester = $Regex_FillInThePester } } - Return $HelpFilesTestCases + return $HelpFilesTestCases } Context ('Validating help file fields have been populated') { It ('The file "" needs to be populated on line number "" where "" exists.') -TestCases:(Get-HelpFilesTestCases) { - If ($Path) { + if ($Path) { $Path | Should -Not -FileContentMatch ($Regex_FillInThePester) } } @@ -30,7 +30,7 @@ Describe -Tag:('ModuleValidation') 'Help File Tests' { $ModulePathLocation = "$PSScriptRoot/../../../JumpCloud Module" # run the Build-HelpFiles function to generate new docs: Start-Job -Name BuildHelpFiles -ScriptBlock { . $using:BuildHelpFilesLocation -ModuleName "JumpCloud" -ModulePath $using:ModulePathLocation } - Wait-Job -Name BuildHelpFiles + Wait-Job -Name BuildHelpFiles # validate that there's no changes to git diff $ModuleRoot = (Get-Item -Path:($PSScriptRoot)).Parent.Parent @@ -46,7 +46,7 @@ Describe -Tag:('ModuleValidation') 'Help File Tests' { Test-Path -Path $_.FullName | Should -Be $true # Git Diff for the file should not exist - $diff = git diff -- $_.FullName + $diff = git diff --ignore-cr-at-eol -- $_.FullName if ($diff) { Write-Warning "Diff found in the file $($_.FullName) when we expected none to exist; Please run Build-HelpFiles and commit the results" } diff --git a/PowerShell/JumpCloud Module/Tests/ModuleValidation/SDKImport.Tests.ps1 b/PowerShell/JumpCloud Module/Tests/ModuleValidation/SDKImport.Tests.ps1 index 0e5c468fe..c0a5786c0 100644 --- a/PowerShell/JumpCloud Module/Tests/ModuleValidation/SDKImport.Tests.ps1 +++ b/PowerShell/JumpCloud Module/Tests/ModuleValidation/SDKImport.Tests.ps1 @@ -1,6 +1,6 @@ Describe -Tag:('ModuleValidation') 'SDK Generation' { - it 'tests that the sdks have been generated before release' { + It 'tests that the sdks have been generated before release' -Skip { # run the jcapi to support sync function: . "$PSScriptRoot/../../../Deploy/SdkSync/jcapiToSupportSync.ps1" -RequiredModulesRepo 'PSGallery' # validate that there's no changes to git diff @@ -14,11 +14,11 @@ Describe -Tag:('ModuleValidation') 'SDK Generation' { $functionFilePath = "$FolderPath_Public" -replace "/Public", "$($subitem.Destination)/$($subitem.Name).ps1" $functionFilePath = "$functionFilePath" -replace "JcSdk", "JC" # Each function defined in the jcapiToSupportSync file should exist - Test-Path -Path $functionFilePath | should -Be $true + Test-Path -Path $functionFilePath | Should -Be $true # Git Diff for the file should not exist - $diff = git diff -w $functionFilePath + $diff = git diff --ignore-cr-at-eol -w $functionFilePath if ($diff) { - write-warning "diff found in file: $functionFilePath when we expected none to exist; have you run jcapiToSupportSync.ps1 and committed the resulting changes?" + Write-Warning "diff found in file: $functionFilePath when we expected none to exist; have you run jcapiToSupportSync.ps1 and committed the resulting changes?" } $diff | Should -BeNullOrEmpty } diff --git a/PowerShell/JumpCloud Module/Tests/Public/Association/Get-JCAssociation.Tests.ps1 b/PowerShell/JumpCloud Module/Tests/Public/Association/Get-JCAssociation.Tests.ps1 index 3a86dcb6e..345487e99 100644 --- a/PowerShell/JumpCloud Module/Tests/Public/Association/Get-JCAssociation.Tests.ps1 +++ b/PowerShell/JumpCloud Module/Tests/Public/Association/Get-JCAssociation.Tests.ps1 @@ -3,13 +3,19 @@ Describe -Tag:('JCAssociation') "Association Tests" { # Generate possible associations $JCAssociationTypes = Get-JCType | Where-Object { $_.Category -eq 'JumpCloud' } # | Get-Random -Count 1 # remove when not testing $EmptySources = @() - ForEach ($JCAssociationType In $JCAssociationTypes) { - $Source = Get-JCObject -Type:($JCAssociationType.TypeName.TypeNameSingular) | Select-Object -First 1 # | Get-Random - $AssociationDataSet = If ($Source) { - ForEach ($TargetSingular In $Source.Targets.TargetSingular) { - If ( $TargetSingular -notin $EmptySources) { + foreach ($JCAssociationType in $JCAssociationTypes) { + if ($JCAssociationType.TypeName.TypeNameSingular -eq 'user') { + $NewUser = New-RandomUser -domain "association.$(New-RandomString -NumberOfChars 5)" | New-JCUser + $Source = $NewUser + + } else { + $Source = Get-JCObject -Type:($JCAssociationType.TypeName.TypeNameSingular) | Select-Object -First 1 # | Get-Random + } + $AssociationDataSet = if ($Source) { + foreach ($TargetSingular in $Source.Targets.TargetSingular) { + if ( $TargetSingular -notin $EmptySources) { $Target = Get-JCObject -Type:($TargetSingular) | Get-Random -Count 1 # | Select-Object -First 1 # | Get-Random - If ($Target) { + if ($Target) { @{ 'SourceType' = $Source.TypeName.TypeNameSingular; 'SourceId' = $Source.($Source.ById); @@ -21,7 +27,7 @@ Describe -Tag:('JCAssociation') "Association Tests" { 'Target' = $Target; 'ValidRecord' = $true; } - } Else { + } else { $EmptySources += $TargetSingular @{ 'SourceType' = $Source.TypeName.TypeNameSingular; @@ -37,7 +43,7 @@ Describe -Tag:('JCAssociation') "Association Tests" { } } } - } Else { + } else { $EmptySources += $JCAssociationType.TypeName.TypeNameSingular $JCAssociationType.Targets | ForEach-Object { @{ @@ -152,10 +158,10 @@ Describe -Tag:('JCAssociation') "Association Tests" { Write-Host("Test Object" + $Associations_Test) $Associations_Test | Should -Not -BeNullOrEmpty ($Associations_Test | Measure-Object).Count | Should -BeGreaterThan 0 - If ($value -match '-Raw') { + if ($value -match '-Raw') { $TestParam.TargetId | Should -BeIn $Associations_Test.Id $TestParam.TargetType | Should -BeIn $Associations_Test.Type - } Else { + } else { $TestParam.TargetId | Should -BeIn $Associations_Test.TargetId $TestParam.TargetType | Should -BeIn $Associations_Test.TargetType $TestParam.SourceId | Should -BeIn $Associations_Test.Id diff --git a/PowerShell/JumpCloud Module/Tests/Public/Authentication/Connect-JCOnline.Tests.ps1 b/PowerShell/JumpCloud Module/Tests/Public/Authentication/Connect-JCOnline.Tests.ps1 index 9013abeb5..0c5801bba 100755 --- a/PowerShell/JumpCloud Module/Tests/Public/Authentication/Connect-JCOnline.Tests.ps1 +++ b/PowerShell/JumpCloud Module/Tests/Public/Authentication/Connect-JCOnline.Tests.ps1 @@ -1,12 +1,25 @@ Describe -Tag:('JCOnline') 'Connect-JCOnline Tests' { BeforeAll { - $StartingApiKey = If (-not [System.String]::IsNullOrEmpty($env:JCApiKey)) { + $StartingApiKey = if (-not [System.String]::IsNullOrEmpty($env:JCApiKey)) { $env:JCApiKey } - $StartingOrgId = If (-not [System.String]::IsNullOrEmpty($env:JCOrgId)) { + $StartingOrgId = if (-not [System.String]::IsNullOrEmpty($env:JCOrgId)) { $env:JCOrgId } } + Context 'EU Org Tests' { + It ('Should connect using the EU JumpCloudApiKey and JumpCloudOrgId parameters.') { + $Connect = Connect-JCOnline -JumpCloudApiKey:($PesterParams_EU_ApiKey) -JumpCloudOrgId:($PesterParams_EU_OrgID) -JCEnvironment 'EU' -force + $PesterParams_EU_ApiKey | Should -Be $env:JCApiKey + $PesterParams_EU_OrgID | Should -Be $env:JCOrgId + + $env:JCEnvironment | Should -Be 'EU' + + $Connect = Connect-JCOnline -JumpCloudApiKey:($PesterParams_ApiKey) -JumpCloudOrgId:($PesterParams_Org.OrgID) -JCEnvironment 'STANDARD' -force + $PesterParams_ApiKey | Should -Be $env:JCApiKey + $PesterParams_Org.OrgID | Should -Be $env:JCOrgId + } + } Context 'Single Org Tests' { It ('Should connect using the JumpCloudApiKey and JumpCloudOrgId parameters.') { $Connect = Connect-JCOnline -JumpCloudApiKey:($PesterParams_ApiKey) -JumpCloudOrgId:($PesterParams_Org.OrgID) -force @@ -44,13 +57,13 @@ Describe -Tag:('JCOnline') 'Connect-JCOnline Tests' { } } AfterAll { - If (-not [System.String]::IsNullOrEmpty($StartingApiKey) -and -not [System.String]::IsNullOrEmpty($StartingOrgId)) { + if (-not [System.String]::IsNullOrEmpty($StartingApiKey) -and -not [System.String]::IsNullOrEmpty($StartingOrgId)) { Connect-JCOnline -JumpCloudApiKey:($StartingApiKey) -JumpCloudOrgId:($StartingOrgId) -force | Out-Null - } ElseIf (-not [System.String]::IsNullOrEmpty($StartingApiKey) -and [System.String]::IsNullOrEmpty($StartingOrgId)) { + } elseif (-not [System.String]::IsNullOrEmpty($StartingApiKey) -and [System.String]::IsNullOrEmpty($StartingOrgId)) { Connect-JCOnline -JumpCloudApiKey:($StartingApiKey) -force | Out-Null - } ElseIf ([System.String]::IsNullOrEmpty($StartingApiKey) -and -not [System.String]::IsNullOrEmpty($StartingOrgId)) { + } elseif ([System.String]::IsNullOrEmpty($StartingApiKey) -and -not [System.String]::IsNullOrEmpty($StartingOrgId)) { Connect-JCOnline -JumpCloudOrgId:($StartingOrgId) -force | Out-Null - } Else { + } else { Write-Error ('Unknown scenario encountered') } } diff --git a/PowerShell/JumpCloud Module/Tests/Public/DirectoryInsights/Get-JCEventCount.Tests.ps1 b/PowerShell/JumpCloud Module/Tests/Public/DirectoryInsights/Get-JCEventCount.Tests.ps1 index fa672ca39..2d0dc4ebf 100644 --- a/PowerShell/JumpCloud Module/Tests/Public/DirectoryInsights/Get-JCEventCount.Tests.ps1 +++ b/PowerShell/JumpCloud Module/Tests/Public/DirectoryInsights/Get-JCEventCount.Tests.ps1 @@ -35,11 +35,11 @@ Describe 'Get-JCEventCount' -Tag:('JCEvent') { It 'GetExpanded' { $eventTest = Get-JCEventCount -Service:($ParamHash.Service) -StartTime:($ParamHash.StartTime) -EndTime:($ParamHash.EndTime) -Sort:($ParamHash.Sort) -SearchTermAnd:($ParamHash.SearchTermAnd) $eventTest | Should -Not -BeNullOrEmpty - $eventTest | Should -BeOfType System.Int64 + $eventTest.Count | Should -BeOfType System.Int64 } It 'Get' { $eventTest = Get-JCEventCount -Body:($ParamHash) $eventTest | Should -Not -BeNullOrEmpty - $eventTest | Should -BeOfType System.Int64 + $eventTest.Count | Should -BeOfType System.Int64 } } diff --git a/PowerShell/JumpCloud Module/Tests/Public/Policies/New-JCPolicy.Tests.ps1 b/PowerShell/JumpCloud Module/Tests/Public/Policies/New-JCPolicy.Tests.ps1 index 231138381..76c156dd0 100644 --- a/PowerShell/JumpCloud Module/Tests/Public/Policies/New-JCPolicy.Tests.ps1 +++ b/PowerShell/JumpCloud Module/Tests/Public/Policies/New-JCPolicy.Tests.ps1 @@ -18,7 +18,8 @@ Describe -Tag:('JCPolicy') 'New-JCPolicy' { $templateId = $policyTemplate.id $intValue = 45 $intPolicy = New-JCPolicy -Name "Pester - Integer Dynamic" -templateID $templateId -timeout $intValue - $intPolicy.values.value | Should -Be $intValue + $intPolicyTimeoutValue = $intPolicy.Values | Where-Object { $_.ConfigFieldName -eq 'timeout' } + $intPolicyTimeoutValue.value | Should -Be $intValue } It 'Creates a new policy that tests boolean' { diff --git a/PowerShell/JumpCloud Module/Tests/Public/Policies/Set-JCPolicy.Tests.ps1 b/PowerShell/JumpCloud Module/Tests/Public/Policies/Set-JCPolicy.Tests.ps1 index 7f49e8889..63317587f 100644 --- a/PowerShell/JumpCloud Module/Tests/Public/Policies/Set-JCPolicy.Tests.ps1 +++ b/PowerShell/JumpCloud Module/Tests/Public/Policies/Set-JCPolicy.Tests.ps1 @@ -169,8 +169,9 @@ Describe -Tag:('JCPolicy') 'Set-JCPolicy' { $intPolicy = New-JCPolicy -Name "Pester - Integer" -templateID $templateId -timeout $intValue $updatedIntValue = 55 $updatedStringPolicy = Set-JCPolicy -policyID $intPolicy.id -timeout $updatedIntValue + $intPolicyTimeoutValue = $updatedStringPolicy.Values | Where-Object { $_.ConfigFieldName -eq 'timeout' } # Should not be null - $updatedStringPolicy.values.value | Should -Be $updatedIntValue + $intPolicyTimeoutValue.value | Should -Be $updatedIntValue } It 'Sets a policy with a boolean, multi select and string type dynamic parameter' { $policyTemplate = $policyTemplates | Where-Object { $_.name -eq "app_notifications_darwin" } @@ -334,8 +335,9 @@ Describe -Tag:('JCPolicy') 'Set-JCPolicy' { $stringPolicy = New-JCPolicy -Name "Pester - Integer byName" -templateID $templateId -timeout $intValue $updatedIntValue = 55 $updatedStringPolicy = Set-JCPolicy -PolicyName $stringPolicy.Name -timeout $updatedIntValue + $intPolicyTimeoutValue = $updatedStringPolicy.Values | Where-Object { $_.ConfigFieldName -eq 'timeout' } # Should not be null - $updatedStringPolicy.values.value | Should -Be $updatedIntValue + $intPolicyTimeoutValue.value | Should -Be $updatedIntValue } It 'Sets a policy with a boolean, multi select and string type dynamic parameter' { $policyTemplate = $policyTemplates | Where-Object { $_.name -eq "app_notifications_darwin" } diff --git a/PowerShell/JumpCloud Module/Tests/Public/settings/Set-JCSettingsFile.Tests.ps1 b/PowerShell/JumpCloud Module/Tests/Public/settings/Set-JCSettingsFile.Tests.ps1 index a06e15e55..3efee1034 100644 --- a/PowerShell/JumpCloud Module/Tests/Public/settings/Set-JCSettingsFile.Tests.ps1 +++ b/PowerShell/JumpCloud Module/Tests/Public/settings/Set-JCSettingsFile.Tests.ps1 @@ -1,5 +1,5 @@ Describe -Tag "JCSettingsFile" -Name "Set JCSettings Tests" { - it "Settings File can be modified" { + It "Settings File can be modified" { # Get previous file modified Time $previousModifiedDate = (Get-Item "$PSScriptRoot\..\..\..\Config.json").LastWriteTime # Get old config file: @@ -19,4 +19,25 @@ Describe -Tag "JCSettingsFile" -Name "Set JCSettings Tests" { # Test that new config file is actually modified $lastModifiedDate | Should -BeGreaterThan $previousModifiedDate } + + It 'Changes JCEnvironment' { + # Get old config file: + $oldConfig = Get-JCSettingsFile + # Set JCEnvironment to EU + Set-JCSettingsFile -JCEnvironmentLocation 'EU' + # Get modified config file: + $modifiedConfig = Get-JCSettingsFile + # Check that the setting was modified + $oldConfig.JCEnvironment.Location | Should -Not -Be $modifiedConfig.JCEnvironment.Location + $modifiedConfig.JCEnvironment.Location | Should -Be 'EU' + # Check that env variable is set + $env:JCEnvironment | Should -Be 'EU' + $global:JCEnvironment | Should -Be 'EU' + + # Revert changes + Set-JCSettingsFile -JCEnvironmentLocation 'STANDARD' + # Check that env variable is set + $env:JCEnvironment | Should -Be 'STANDARD' + $global:JCEnvironment | Should -Be 'STANDARD' + } } \ No newline at end of file diff --git a/PowerShell/JumpCloud Module/en-Us/JumpCloud-help.xml b/PowerShell/JumpCloud Module/en-Us/JumpCloud-help.xml index 2f77dc900..22c90d34f 100644 --- a/PowerShell/JumpCloud Module/en-Us/JumpCloud-help.xml +++ b/PowerShell/JumpCloud Module/en-Us/JumpCloud-help.xml @@ -2471,8 +2471,9 @@ PS C:\> $BackupJcOrganizationResults.User Specific to JumpCloud development team to connect to staging dev environment. - production + STANDARD staging + EU System.String @@ -4546,6 +4547,7 @@ PS C:\> $BackupJcOrganizationResults.User 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' + aiGenerated command name launchType @@ -5353,6 +5355,18 @@ PS C:\> $BackupJcOrganizationResults.User None + + ExactMatch + + optional string for specifying exact match query, do not use with full text query + + System.String + + System.String + + + None + Fields @@ -5523,6 +5537,18 @@ PS C:\> $BackupJcOrganizationResults.User None + + ExactMatch + + optional string for specifying exact match query, do not use with full text query + + System.String + + System.String + + + None + Fields @@ -5825,6 +5851,18 @@ PS C:\> $BackupJcOrganizationResults.User None + + ExactMatch + + optional string for specifying exact match query, do not use with full text query + + System.String + + System.String + + + None + Fields @@ -5983,6 +6021,18 @@ PS C:\> $BackupJcOrganizationResults.User None + + ExactMatch + + optional string for specifying exact match query, do not use with full text query + + System.String + + System.String + + + None + Fields @@ -6130,7 +6180,7 @@ PS C:\> $BackupJcOrganizationResults.User - System.Int64 + JumpCloud.SDK.DirectoryInsights.Models.IEventCount @@ -8044,9 +8094,9 @@ PS C:\> $BackupJcOrganizationResults.User Sort type and direction. Default sort is descending, prefix with - to sort ascending. - JumpCloud.SDK.DirectoryInsights.Support.Sort + System.Object - JumpCloud.SDK.DirectoryInsights.Support.Sort + System.Object None @@ -8084,9 +8134,9 @@ PS C:\> $BackupJcOrganizationResults.User Sort type and direction. Default sort is descending, prefix with - to sort ascending. - JumpCloud.SDK.DirectoryInsights.Support.Sort + System.Object - JumpCloud.SDK.DirectoryInsights.Support.Sort + System.Object None @@ -8538,6 +8588,7 @@ $reportContent = Get-JCReport -reportID $lastReport.id -type 'csv' allowSshPasswordAuthentication allowSshRootLogin arch + attributes azureAdJoined connectionHistory created @@ -13161,9 +13212,9 @@ PS C:\> New-JCPolicy -TemplateName darwin_Login_Window_Text -Values $policyV Report Type - JumpCloud.SDK.DirectoryInsights.Support.ReportType1 + System.Object - JumpCloud.SDK.DirectoryInsights.Support.ReportType1 + System.Object None @@ -13211,9 +13262,9 @@ PS C:\> New-JCPolicy -TemplateName darwin_Login_Window_Text -Values $policyV Report Type - JumpCloud.SDK.DirectoryInsights.Support.ReportType1 + System.Object - JumpCloud.SDK.DirectoryInsights.Support.ReportType1 + System.Object None @@ -20314,6 +20365,18 @@ PS C:\> Set-JCPolicy -PolicyName "macOS - Login Window Policy" -Values $poli Set-JCSettingsFile + + JCEnvironmentLocation + + sets the System.Management.Automation.PSCustomObject Location=@{write=True; copy=True; value=STANDARD} settings for the System.Management.Automation.PSCustomObject JCEnvironment=@{Location=} feature + + System.Management.Automation.PSObject + + System.Management.Automation.PSObject + + + None + moduleBannerMessageCount @@ -20342,6 +20405,18 @@ PS C:\> Set-JCPolicy -PolicyName "macOS - Login Window Policy" -Values $poli + + JCEnvironmentLocation + + sets the System.Management.Automation.PSCustomObject Location=@{write=True; copy=True; value=STANDARD} settings for the System.Management.Automation.PSCustomObject JCEnvironment=@{Location=} feature + + System.Management.Automation.PSObject + + System.Management.Automation.PSObject + + + None + moduleBannerMessageCount diff --git a/PowerShell/ModuleChangelog.md b/PowerShell/ModuleChangelog.md index 5656c5c26..791d7f644 100644 --- a/PowerShell/ModuleChangelog.md +++ b/PowerShell/ModuleChangelog.md @@ -1,3 +1,19 @@ +## 3.0.0 + +Release Date: December 2, 2025 + +#### RELEASE NOTES + +``` +Introduced support for EU based organizations with Connect-JCOnline +``` + +#### FEATURES: + +- Introduces the `-JCEnvironment` parameter for `Connect-JCOnline` + - This now allows organizations based in the EU datacenter to run PowerShell commands +- Refactored hardcoded endpoint URLs to use a variable depending on which datacenter the module is connected to + ## 2.18.2 Release Date: September 8, 2025 @@ -10,7 +26,7 @@ Fixed an issue with excluding properties for Update-JCDeviceFromCSV when using P #### BUG FIXES: -* Address a bug impacting Update-JCDeviceFromCSV +- Address a bug impacting Update-JCDeviceFromCSV ## 2.18.1 @@ -24,7 +40,7 @@ Implements fix for errors in module directory path resolution #### BUG FIXES: -* Addresses a bug that impacted module directory paths. +- Addresses a bug that impacted module directory paths. ## 2.18.0 @@ -39,15 +55,17 @@ Introduces the primarySystemUser parameter to Set-JCSystem and Update-JCDeviceFr ``` #### FEATURES: + - Introduces support for passing list of objects (uriList) for Custom MDM (OMA-URI) policy with New/Set-JCPolicy - Dynamic param added `-uriList` - Menu for `Set-JCPolicy` to edit uriList - create/update/add/remove + * Added the primarySystemUser parameter to Set-JCSystem * Update-JCDeviceFromCSV supports the primarySystemUser param that was added to Set-JCSystem #### BUG FIXES: -* Added an Alias of GroupID to the ByID parameter for Get-JCUserGroupMember +- Added an Alias of GroupID to the ByID parameter for Get-JCUserGroupMember ## 2.17.0