Closed o-l-a-v closed 2 years ago
Jabra webpage returns webpage in native language if available, that might be the cause of it.
Here is some (for now) working PowerShell to get latest available version.
[System.Version](
(
Invoke-RestMethod -Method 'Get' -Uri 'https://www.jabra.com/Support/release-notes/release-note-jabra-direct'
).Split(
[System.Environment]::NewLine,
[System.StringSplitOptions]::RemoveEmptyEntries
).Where{
-not [string]::IsNullOrEmpty($_)
}.ForEach{
$_.Trim() -replace '\s{2,}', ' '
}.Where{
$_ -like '*?.?.?*<br>*'
}[0].Split(
' ',
[System.StringSplitOptions]::RemoveEmptyEntries
).ForEach{
$_.Replace('<br>','')
}.Where{
$_ -like '?.?.?*'
}[0]
)
I tried to look for some headers or URL parameters to request English language, but did not find anything in my short research here.
Thanks for the report, could you please confirm if it's still an issue? It's working for me at the moment with an English OS, I will investigate!
@DanGough
Yup, still a problem. English OS. en-SE culture (Get-Culture, LCID = 8192).
Hi, would you be able to try the version I've just uploaded to Dev at all?
I got an error if I tried switching it from .co.uk to .com, unless I set the user agent to GoogleBot, so I've now tweaked the internal function Get-Version to support a UserAgent parameter. I've used this and also switched the URL to use .com, and changed the match parameter to find the first version number followed by <br>
, so that it works independent of language.
It worked. :)
Test script:
#Requires -Version 5.1
<#
.SYNOPSIS
Test dev branch of Nevergreen by first downloading it to desktop and unzip it.
.NOTES
Author: Olav Rønnestad Birkeland
Created: 211015
Modified: 211015
.EXAMPLE
& $psISE.CurrentFile.FullPath -Name 'JabraDirect'
#>
# Input parameters
[OutputType($null)]
Param(
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[string] $Name
)
# PowerShell preferences
$ErrorActionPreference = 'Stop'
$InformationPreference = 'Continue'
# Import dev module
## Introduce step
Write-Information -MessageData '# Import module'
## Create expected module path
$ModulePath = [string] '{0}\Nevergreen-dev\Nevergreen\Nevergreen.psm1' -f [System.Environment]::GetFolderPath('Desktop')
## Chech that it exists
if (-not [System.IO.File]) {
Throw ('Did not find module at "{0}".' -f $ModulePath)
}
## Remove if imported from different path
if ($(Try{(Get-Module -Name 'Nevergreen').'Path' -ne $ModulePath}Catch{$false})) {
$null = Remove-Module -Name 'Nevergreen' -Force
}
## Import if needed
if ($(Try{(Get-Module -Name 'Nevergreen').'Path' -eq $ModulePath}Catch{$false})) {
Write-Information -MessageData 'Module already imported.'
}
else {
Write-Information -MessageData 'Module not already imported.'
$null = Import-Module -Name $ModulePath -Force
}
## View module and version
Get-Module -Name 'Nevergreen' | Format-List
# Test getting version of Jabra Direct
## Introduce step
Write-Information -MessageData ('{0}# Try get version of "{1}"' -f [System.Environment]::NewLine, $Name)
## Get version
Get-NevergreenApp -Name $Name
Output
PS C:\Users\birola> & $psISE.CurrentFile.FullPath -Name 'JabraDirect'
# Import module
Module already imported.
Name : Nevergreen
Path : C:\Users\birola\OneDrive - <removed>\Skrivebord\Nevergreen-dev\Nevergreen\Nevergreen.psm1
Description :
ModuleType : Script
Version : 0.0
NestedModules : {}
ExportedFunctions : {Find-NevergreenApp, Get-NevergreenApp}
ExportedCmdlets :
ExportedVariables :
ExportedAliases :
# Try get version of "JabraDirect"
Name : Jabra Direct
Architecture : Multi
Type : Exe
Version : 5.8.49513
Uri : https://jabraxpressonlineprdstor.blob.core.windows.net/jdo/JabraDirectSetup.exe
PS C:\Users\birola>
Seems the logic for Jabra Direct is borked. Not a issue for me, just a heads up. :)
And version of the module