From f0dafc04c47ba7aefdd84d60cd93d8983880eac1 Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Thu, 31 Oct 2024 14:31:44 +0100 Subject: [PATCH] Freddydk/filesonlyperf (#3745) filesonly containers doesn't work with winrm sessions Fixes https://github.com/microsoft/AL-Go/issues/1284 --------- Co-authored-by: freddydk --- ContainerHandling/Get-NavContainerSession.ps1 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ContainerHandling/Get-NavContainerSession.ps1 b/ContainerHandling/Get-NavContainerSession.ps1 index afb187b0f..db4c3aa02 100644 --- a/ContainerHandling/Get-NavContainerSession.ps1 +++ b/ContainerHandling/Get-NavContainerSession.ps1 @@ -26,7 +26,14 @@ function Get-BcContainerSession { Process { $newsession = $false $session = $null - [System.Version]$platformVersion = Get-BcContainerPlatformVersion -containerOrImageName $containerName + $inspect = docker inspect $containerName | ConvertFrom-Json + if (!($inspect.Config.Labels.psobject.Properties.Name -eq 'maintainer' -and $inspect.Config.Labels.maintainer -eq "Dynamics SMB")) { + throw "Container $containerOrImageName is not a NAV/BC container" + } + [System.Version]$platformVersion = [System.Version]"$($inspect.Config.Labels.platform)" + if ($inspect.Config.Labels.PSObject.Properties.Name -eq 'filesonly' -and $inspect.Config.Labels.filesonly -eq 'yes') { + $tryWinRmSession = 'never' + } if ($platformVersion.Major -lt 24) { $usePwsh = $false }