remove usepwsh false and require 1.0.2.20 (#3497)

1.0.2.20 now has SqlServer PS module preinstalled on PS 7 + compatible
overrides

---------

Co-authored-by: freddydk <freddydk@users.noreply.github.com>
This commit is contained in:
Freddy Kristiansen 2024-04-23 08:20:52 +02:00 коммит произвёл GitHub
Родитель f3af93a3e7
Коммит a71489d9b3
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
10 изменённых файлов: 24 добавлений и 25 удалений

Просмотреть файл

@ -96,7 +96,7 @@ try {
$copyTables += @("Entitlement", "Entitlement Set", "Membership Entitlement")
}
Invoke-ScriptInBCContainer -containerName $containerName -usePwsh:$false -scriptblock { Param($platformVersion, $databaseName, $databaseServer, $databaseInstance, $copyTables, $multitenant)
Invoke-ScriptInBCContainer -containerName $containerName -scriptblock { Param($platformVersion, $databaseName, $databaseServer, $databaseInstance, $copyTables, $multitenant)
Write-Host "Stopping ServiceTier in order to replace database"
Set-NavServerInstance -ServerInstance $ServerInstance -stop
@ -196,7 +196,7 @@ try {
if ($customconfig.Multitenant -eq "True") {
Write-Host "Switching to multitenancy"
Invoke-ScriptInBCContainer -containerName $containerName -usePwsh:$false -scriptblock { Param($databaseName, $databaseServer, $databaseInstance)
Invoke-ScriptInBCContainer -containerName $containerName -scriptblock { Param($databaseName, $databaseServer, $databaseInstance)
$databaseServerInstance = $databaseServer
if ($databaseInstance) {
$databaseServerInstance += "\$databaseInstance"

Просмотреть файл

@ -367,7 +367,7 @@ try {
# locate application version number in database if using SQLEXPRESS
try {
if (($customConfig.DatabaseServer -eq "localhost") -and ($customConfig.DatabaseInstance -eq "SQLEXPRESS")) {
$appVersion = Invoke-ScriptInBcContainer -containerName $containerName -usePwsh:$false -scriptblock { Param($databaseName)
$appVersion = Invoke-ScriptInBcContainer -containerName $containerName -scriptblock { Param($databaseName)
(invoke-sqlcmd -ServerInstance 'localhost\SQLEXPRESS' -ErrorAction Stop -Query "SELECT [applicationversion] FROM [$databaseName].[dbo].[`$ndo`$dbproperty]").applicationVersion
} -argumentList $customConfig.DatabaseName
$publishedApps += @{ "Name" = "Application"; "Publisher" = "Microsoft"; "Version" = $appversion }

Просмотреть файл

@ -49,7 +49,7 @@ try {
}
$containerBakFolder = Get-BcContainerPath -containerName $containerName -path $bakFolder -throw
Invoke-ScriptInBcContainer -containerName $containerName -usePwsh:$false -ScriptBlock { Param($containerBakfolder, $bakFolder, $tenant, $databasecredential, $compress)
Invoke-ScriptInBcContainer -containerName $containerName -ScriptBlock { Param($containerBakfolder, $bakFolder, $tenant, $databasecredential, $compress)
function Backup {
Param (

Просмотреть файл

@ -64,7 +64,7 @@ try {
}
$containerBacpacFolder = Get-BcContainerPath -containerName $containerName -path $bacpacFolder -throw
Invoke-ScriptInBcContainer -containerName $containerName -usePwsh:$false -ScriptBlock { Param([PSCredential]$sqlCredential, $bacpacFolder, $tenant, $commandTimeout, $includeDacPac, $diagnostics, $additionalArguments, $doNotCheckEntitlements)
Invoke-ScriptInBcContainer -containerName $containerName -ScriptBlock { Param([PSCredential]$sqlCredential, $bacpacFolder, $tenant, $commandTimeout, $includeDacPac, $diagnostics, $additionalArguments, $doNotCheckEntitlements)
function CmdDo {
Param(

Просмотреть файл

@ -70,7 +70,7 @@ try {
$containerBakFolder = Get-BcContainerPath -containerName $containerName -path $bakFolder -throw
}
Invoke-ScriptInBCContainer -containerName $containerName -usePwsh:$false -scriptblock { Param($bakFolder, $bakFile, $databaseName, $tenant, $databaseFolder, $sqlTimeout)
Invoke-ScriptInBCContainer -containerName $containerName -scriptblock { Param($bakFolder, $bakFile, $databaseName, $tenant, $databaseFolder, $sqlTimeout)
function Restore {
Param (

Просмотреть файл

@ -779,7 +779,7 @@ try {
$imageName = $bestImageName
if ($artifactUrl) {
$genericTagVersion = [Version](Get-BcContainerGenericTag -containerOrImageName $imageName)
if ($genericTagVersion -lt [Version]"1.0.2.15") {
if ($genericTagVersion -lt [Version]"1.0.2.20") {
Write-Host "Generic image is version $genericTagVersion - pulling a newer image"
$pullit = $true
}
@ -2045,7 +2045,7 @@ if (-not `$restartingInstance) {
if ($SqlServerMemoryLimit -and $customConfig.databaseServer -eq "localhost" -and $customConfig.databaseInstance -eq "SQLEXPRESS") {
Write-Host "Set SQL Server memory limit to $SqlServerMemoryLimit MB"
Invoke-ScriptInBCContainer -containerName $containerName -usePwsh:$false -scriptblock { Param($SqlServerMemoryLimit)
Invoke-ScriptInBCContainer -containerName $containerName -scriptblock { Param($SqlServerMemoryLimit)
Invoke-Sqlcmd -ServerInstance 'localhost\SQLEXPRESS' -Query "USE master EXEC sp_configure 'show advanced options', 1 RECONFIGURE WITH OVERRIDE;"
Invoke-Sqlcmd -ServerInstance 'localhost\SQLEXPRESS' -Query "USE master EXEC sp_configure 'max server memory', $SqlServerMemoryLimit RECONFIGURE WITH OVERRIDE;"
Invoke-Sqlcmd -ServerInstance 'localhost\SQLEXPRESS' -Query "USE master EXEC sp_configure 'show advanced options', 0 RECONFIGURE WITH OVERRIDE;"
@ -2443,7 +2443,7 @@ if (-not `$restartingInstance) {
if ($multitenant) {
Write-Host "Switching to multitenant"
Invoke-ScriptInBCContainer -containerName $containerName -usePwsh:$false -scriptblock {
Invoke-ScriptInBCContainer -containerName $containerName -scriptblock {
$customConfigFile = Join-Path (Get-Item "C:\Program Files\Microsoft Dynamics NAV\*\Service").FullName "CustomSettings.config"
[xml]$customConfig = [System.IO.File]::ReadAllText($customConfigFile)

Просмотреть файл

@ -1259,6 +1259,17 @@ function DownloadLatestAlLanguageExtension {
[switch] $allowPrerelease
)
# Check if we already have the latest version downloaded and located in this session
if ($script:AlLanguageExtenssionPath[$allowPrerelease.IsPresent]) {
$path = $script:AlLanguageExtenssionPath[$allowPrerelease.IsPresent]
if (Test-Path $path -PathType Container) {
return $path
}
else {
$script:AlLanguageExtenssionPath[$allowPrerelease.IsPresent] = ''
}
}
$mutexName = "DownloadAlLanguageExtension"
$mutex = New-Object System.Threading.Mutex($false, $mutexName)
try {
@ -1273,17 +1284,6 @@ function DownloadLatestAlLanguageExtension {
Write-Host "Other process terminated abnormally"
}
# Check if we already have the latest version downloaded and located in this session
if ($script:AlLanguageExtenssionPath[$allowPrerelease.IsPresent]) {
$path = $script:AlLanguageExtenssionPath[$allowPrerelease.IsPresent]
if (Test-Path $path -PathType Container) {
return $path
}
else {
$script:AlLanguageExtenssionPath[$allowPrerelease.IsPresent] = ''
}
}
$version, $url = GetLatestAlLanguageExtensionVersionAndUrl -allowPrerelease:$allowPrerelease
$path = Join-Path $bcContainerHelperConfig.hostHelperFolder "alLanguageExtension/$version"
if (!(Test-Path $path -PathType Container)) {
@ -1312,8 +1312,7 @@ function RunAlTool {
Param(
[string[]] $arguments
)
# ALTOOL is at the moment only available in prerelease
$path = DownloadLatestAlLanguageExtension -allowPrerelease
$path = DownloadLatestAlLanguageExtension
if ($isLinux) {
$alToolExe = Join-Path $path 'extension/bin/linux/altool'
Write-Host "Setting execute permissions on altool"

Просмотреть файл

@ -26,7 +26,7 @@ $telemetryScope = InitTelemetryScope -name $MyInvocation.InvocationName -paramet
try {
if ($featureKeys.Keys.Count -ne 0) {
Invoke-ScriptInBCContainer -containerName $containerName -usePwsh:$false -ScriptBlock { Param([string] $tenant, [hashtable] $featureKeys)
Invoke-ScriptInBCContainer -containerName $containerName -ScriptBlock { Param([string] $tenant, [hashtable] $featureKeys)
$customConfigFile = Join-Path (Get-Item "C:\Program Files\Microsoft Dynamics NAV\*\Service").FullName "CustomSettings.config"
[xml]$customConfig = [System.IO.File]::ReadAllText($customConfigFile)
$databaseServer = $customConfig.SelectSingleNode("//appSettings/add[@key='DatabaseServer']").Value

Просмотреть файл

@ -46,7 +46,7 @@ try {
throw "You cannot add a tenant called tenant"
}
Invoke-ScriptInBcContainer -containerName $containerName -usePwsh:$false -ScriptBlock { Param($containerName, $tenantId, [PSCredential]$sqlCredential, $sourceDatabase, $destinationDatabase, $alternateId, $doNotCopyDatabase, $allowAppDatabaseWrite, $applicationInsightsKey)
Invoke-ScriptInBcContainer -containerName $containerName -ScriptBlock { Param($containerName, $tenantId, [PSCredential]$sqlCredential, $sourceDatabase, $destinationDatabase, $alternateId, $doNotCopyDatabase, $allowAppDatabaseWrite, $applicationInsightsKey)
$customConfigFile = Join-Path (Get-Item "C:\Program Files\Microsoft Dynamics NAV\*\Service").FullName "CustomSettings.config"
[xml]$customConfig = [System.IO.File]::ReadAllText($customConfigFile)

Просмотреть файл

@ -57,7 +57,7 @@ $telemetryScope = InitTelemetryScope -name $MyInvocation.InvocationName -paramet
try {
$navversion = Get-BcContainerNavversion -containerOrImageName $containerName
$version = [System.Version]($navversion.split('-')[0])
Invoke-ScriptInBcContainer -containerName $containerName -usePwsh:$false -ScriptBlock { param([PSCredential]$Credential, [string]$Tenant, [string]$WindowsAccount, [string]$AuthenticationEMail, [bool]$ChangePasswordAtNextLogOn, [string]$PermissionSetId, [string]$AppName, [string]$AppPublisher, $assignPremiumPlan, [PSCredential]$databaseCredential, [string]$fullName, [System.Version]$version)
Invoke-ScriptInBcContainer -containerName $containerName -ScriptBlock { param([PSCredential]$Credential, [string]$Tenant, [string]$WindowsAccount, [string]$AuthenticationEMail, [bool]$ChangePasswordAtNextLogOn, [string]$PermissionSetId, [string]$AppName, [string]$AppPublisher, $assignPremiumPlan, [PSCredential]$databaseCredential, [string]$fullName, [System.Version]$version)
$TenantParam = @{}
if ($Tenant) {