thejumpcloud / jcapi-powershell Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
Describe the bug
Importing the Jumpcloud version 2.1.0 powershell module fails when attempting to import Get-JCObject.ps1
function. Importing Jumpcloud version 2.0.2 module works without error therefore this seems like a serious regression.
To Reproduce
Install-Module -Name JumpCloud -Force
Import-Module -Name JumpCloud -Force
Steps to reproduce the behavior:
Expected behavior
No Errors
Actual behavior
PS C:\scripts> Install-Module -Name JumpCloud -Force
PS C:\scripts> Import-Module -Name JumpCloud -Force
C:\Program Files\WindowsPowerShell\Modules\JumpCloud\2.1.0\JumpCloud.psm1 : Failed to import function C:\Program Files\WindowsPowerShell\Modules\JumpCloud\2.1.0\Private\NestedFunctions\Get-JCObject.ps1: At
C:\Program Files\WindowsPowerShell\Modules\JumpCloud\2.1.0\Private\NestedFunctions\Get-JCObject.ps1:213 char:71
+ ... $result = $result | Where-Object { $_ –ne $dirResult }
+ ~~~~~~~~~~~~~~~~~~
Unexpected token '–ne $dirResult }
}
}
}
# Validate results
If ($Result -and $Result.PSObject.Properties.name -notcontains 'NoContent') {
If ($SearchBy -and ($Result | Measure-Object).Count -gt 1) {
Write-Warning -Message:('Found "' + [string]($Result | Measure-Object).Count + '" "' + $JCType.TypeName.TypeNamePlural + '" with the "' + $SearchBy.Replace('By', '').ToLower() + '" of "'
+ $SearchByValueItem + '"')
}
$Results += $Result
} ElseIf ($SearchByValueItem) {
Write-Warning ('A "' + $JCType.TypeName.TypeNameSingular + '" called "' + $SearchByValueItem + '" does not exist. Note the search is case sensitive.')
} Else {
Write-Warning ('The search value is blank or no "' + $JCType.TypeName.TypeNamePlural + '" have been setup in your org. SearchValue:"' + $SearchByValueItem + '"')
}
}
# Re-lookup object by id
If ($Results -and $SearchBy -eq 'ByName' -and $JCType.TypeName.TypeNameSingular -notin ('g_suite', 'office_365')) {
# Hacky logic to get g_suite and office_365 directories
$PsBoundParameters.Remove('Name') | Out-Null
$PsBoundParameters.Remove('SearchBy') | Out-Null
$PsBoundParameters.Remove('SearchByValue') | Out-Null
$PsBoundParameters.Add('Id', $Results.($JCType.ById)) | Out-Null
$Results = Get-JCObject @PsBoundParameters
} Else {
If ($Results) {
Write-Verbose "Results' in expression or statement.
At C:\Program Files\WindowsPowerShell\Modules\JumpCloud\2.1.0\Private\NestedFunctions\Get-JCObject.ps1:271 char:54
+ ... + $Type + '" not found. $Type must be:' + ($JCType.TypeName.TypeName ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The string is missing the terminator: ".
At C:\Program Files\WindowsPowerShell\Modules\JumpCloud\2.1.0\Private\NestedFunctions\Get-JCObject.ps1:213 char:66
+ ... $result = $result | Where-Object { $_ –n ...
+ ~
Missing closing '}' in statement block or type definition.
At C:\Program Files\WindowsPowerShell\Modules\JumpCloud\2.1.0\Private\NestedFunctions\Get-JCObject.ps1:212 char:36
+ } else {
+ ~
Missing closing '}' in statement block or type definition.
At C:\Program Files\WindowsPowerShell\Modules\JumpCloud\2.1.0\Private\NestedFunctions\Get-JCObject.ps1:208 char:57
+ foreach ($dirResult in $Result) {
+ ~
Missing closing '}' in statement block or type definition.
At C:\Program Files\WindowsPowerShell\Modules\JumpCloud\2.1.0\Private\NestedFunctions\Get-JCObject.ps1:197 char:90
+ ... f ($JCType.TypeName.TypeNameSingular -in ('g_suite', 'office_365')) {
+ ~
Missing closing '}' in statement block or type definition.
At C:\Program Files\WindowsPowerShell\Modules\JumpCloud\2.1.0\Private\NestedFunctions\Get-JCObject.ps1:137 char:50
+ ForEach ($UrlItem In $UrlObject) {
+ ~
Missing closing '}' in statement block or type definition.
At C:\Program Files\WindowsPowerShell\Modules\JumpCloud\2.1.0\Private\NestedFunctions\Get-JCObject.ps1:27 char:26
+ If ($JCType) {
+ ~
Missing closing '}' in statement block or type definition.
At C:\Program Files\WindowsPowerShell\Modules\JumpCloud\2.1.0\Private\NestedFunctions\Get-JCObject.ps1:26 char:13
+ Try {
+ ~
Missing closing '}' in statement block or type definition.
At C:\Program Files\WindowsPowerShell\Modules\JumpCloud\2.1.0\Private\NestedFunctions\Get-JCObject.ps1:280 char:2
+ }
+ ~
The Try statement is missing its Catch or Finally block.
Not all parse errors were reported. Correct the reported errors and try again.
At line:1 char:1
+ Import-Module -Name JumpCloud -Force
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,JumpCloud.psm1
WARNING: The installed version of PowerShell does not support Parallel functionality. Consider updating to PowerShell 7 to use this feature.
WARNING: Visit aka.ms/powershell-release?tag=stable for latest release
System Device (please complete the following information):
Additional context
Importing ver 2.0.2 works without error..
Install-Module -Name JumpCloud -MaximumVersion 2.0.2 -Force
Import-Module -Name JumpCloud -Force
PS C:\scripts> Uninstall-Module -Name JumpCloud -Force
PS C:\scripts> Install-Module -Name JumpCloud -MaximumVersion 2.0.2 -Force
PS C:\scripts> Import-Module -Name JumpCloud -Force
WARNING: The installed version of PowerShell does not support Parallel functionality. Consider updating to PowerShell 7 to use this feature.
WARNING: Visit aka.ms/powershell-release?tag=stable for latest release
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.