Skip to content

Commit a71489d

Browse files
authored
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 <[email protected]>
1 parent f3af93a commit a71489d

10 files changed

+24
-25
lines changed

AppHandling/Clean-BcContainerDatabase.ps1

+2-2
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ try {
9696
$copyTables += @("Entitlement", "Entitlement Set", "Membership Entitlement")
9797
}
9898

99-
Invoke-ScriptInBCContainer -containerName $containerName -usePwsh:$false -scriptblock { Param($platformVersion, $databaseName, $databaseServer, $databaseInstance, $copyTables, $multitenant)
99+
Invoke-ScriptInBCContainer -containerName $containerName -scriptblock { Param($platformVersion, $databaseName, $databaseServer, $databaseInstance, $copyTables, $multitenant)
100100

101101
Write-Host "Stopping ServiceTier in order to replace database"
102102
Set-NavServerInstance -ServerInstance $ServerInstance -stop
@@ -196,7 +196,7 @@ try {
196196
if ($customconfig.Multitenant -eq "True") {
197197

198198
Write-Host "Switching to multitenancy"
199-
Invoke-ScriptInBCContainer -containerName $containerName -usePwsh:$false -scriptblock { Param($databaseName, $databaseServer, $databaseInstance)
199+
Invoke-ScriptInBCContainer -containerName $containerName -scriptblock { Param($databaseName, $databaseServer, $databaseInstance)
200200
$databaseServerInstance = $databaseServer
201201
if ($databaseInstance) {
202202
$databaseServerInstance += "\$databaseInstance"

AppHandling/Compile-AppInNavContainer.ps1

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

Bacpac/Backup-NavContainerDatabases.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ try {
4949
}
5050
$containerBakFolder = Get-BcContainerPath -containerName $containerName -path $bakFolder -throw
5151

52-
Invoke-ScriptInBcContainer -containerName $containerName -usePwsh:$false -ScriptBlock { Param($containerBakfolder, $bakFolder, $tenant, $databasecredential, $compress)
52+
Invoke-ScriptInBcContainer -containerName $containerName -ScriptBlock { Param($containerBakfolder, $bakFolder, $tenant, $databasecredential, $compress)
5353

5454
function Backup {
5555
Param (

Bacpac/Export-NavContainerDatabasesAsBacpac.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ try {
6464
}
6565
$containerBacpacFolder = Get-BcContainerPath -containerName $containerName -path $bacpacFolder -throw
6666

67-
Invoke-ScriptInBcContainer -containerName $containerName -usePwsh:$false -ScriptBlock { Param([PSCredential]$sqlCredential, $bacpacFolder, $tenant, $commandTimeout, $includeDacPac, $diagnostics, $additionalArguments, $doNotCheckEntitlements)
67+
Invoke-ScriptInBcContainer -containerName $containerName -ScriptBlock { Param([PSCredential]$sqlCredential, $bacpacFolder, $tenant, $commandTimeout, $includeDacPac, $diagnostics, $additionalArguments, $doNotCheckEntitlements)
6868

6969
function CmdDo {
7070
Param(

Bacpac/Restore-DatabasesInNavContainer.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ try {
7070
$containerBakFolder = Get-BcContainerPath -containerName $containerName -path $bakFolder -throw
7171
}
7272

73-
Invoke-ScriptInBCContainer -containerName $containerName -usePwsh:$false -scriptblock { Param($bakFolder, $bakFile, $databaseName, $tenant, $databaseFolder, $sqlTimeout)
73+
Invoke-ScriptInBCContainer -containerName $containerName -scriptblock { Param($bakFolder, $bakFile, $databaseName, $tenant, $databaseFolder, $sqlTimeout)
7474

7575
function Restore {
7676
Param (

ContainerHandling/New-NavContainer.ps1

+3-3
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,7 @@ try {
779779
$imageName = $bestImageName
780780
if ($artifactUrl) {
781781
$genericTagVersion = [Version](Get-BcContainerGenericTag -containerOrImageName $imageName)
782-
if ($genericTagVersion -lt [Version]"1.0.2.15") {
782+
if ($genericTagVersion -lt [Version]"1.0.2.20") {
783783
Write-Host "Generic image is version $genericTagVersion - pulling a newer image"
784784
$pullit = $true
785785
}
@@ -2045,7 +2045,7 @@ if (-not `$restartingInstance) {
20452045

20462046
if ($SqlServerMemoryLimit -and $customConfig.databaseServer -eq "localhost" -and $customConfig.databaseInstance -eq "SQLEXPRESS") {
20472047
Write-Host "Set SQL Server memory limit to $SqlServerMemoryLimit MB"
2048-
Invoke-ScriptInBCContainer -containerName $containerName -usePwsh:$false -scriptblock { Param($SqlServerMemoryLimit)
2048+
Invoke-ScriptInBCContainer -containerName $containerName -scriptblock { Param($SqlServerMemoryLimit)
20492049
Invoke-Sqlcmd -ServerInstance 'localhost\SQLEXPRESS' -Query "USE master EXEC sp_configure 'show advanced options', 1 RECONFIGURE WITH OVERRIDE;"
20502050
Invoke-Sqlcmd -ServerInstance 'localhost\SQLEXPRESS' -Query "USE master EXEC sp_configure 'max server memory', $SqlServerMemoryLimit RECONFIGURE WITH OVERRIDE;"
20512051
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) {
24432443
if ($multitenant) {
24442444
Write-Host "Switching to multitenant"
24452445

2446-
Invoke-ScriptInBCContainer -containerName $containerName -usePwsh:$false -scriptblock {
2446+
Invoke-ScriptInBCContainer -containerName $containerName -scriptblock {
24472447

24482448
$customConfigFile = Join-Path (Get-Item "C:\Program Files\Microsoft Dynamics NAV\*\Service").FullName "CustomSettings.config"
24492449
[xml]$customConfig = [System.IO.File]::ReadAllText($customConfigFile)

HelperFunctions.ps1

+12-13
Original file line numberDiff line numberDiff line change
@@ -1259,6 +1259,17 @@ function DownloadLatestAlLanguageExtension {
12591259
[switch] $allowPrerelease
12601260
)
12611261

1262+
# Check if we already have the latest version downloaded and located in this session
1263+
if ($script:AlLanguageExtenssionPath[$allowPrerelease.IsPresent]) {
1264+
$path = $script:AlLanguageExtenssionPath[$allowPrerelease.IsPresent]
1265+
if (Test-Path $path -PathType Container) {
1266+
return $path
1267+
}
1268+
else {
1269+
$script:AlLanguageExtenssionPath[$allowPrerelease.IsPresent] = ''
1270+
}
1271+
}
1272+
12621273
$mutexName = "DownloadAlLanguageExtension"
12631274
$mutex = New-Object System.Threading.Mutex($false, $mutexName)
12641275
try {
@@ -1273,17 +1284,6 @@ function DownloadLatestAlLanguageExtension {
12731284
Write-Host "Other process terminated abnormally"
12741285
}
12751286

1276-
# Check if we already have the latest version downloaded and located in this session
1277-
if ($script:AlLanguageExtenssionPath[$allowPrerelease.IsPresent]) {
1278-
$path = $script:AlLanguageExtenssionPath[$allowPrerelease.IsPresent]
1279-
if (Test-Path $path -PathType Container) {
1280-
return $path
1281-
}
1282-
else {
1283-
$script:AlLanguageExtenssionPath[$allowPrerelease.IsPresent] = ''
1284-
}
1285-
}
1286-
12871287
$version, $url = GetLatestAlLanguageExtensionVersionAndUrl -allowPrerelease:$allowPrerelease
12881288
$path = Join-Path $bcContainerHelperConfig.hostHelperFolder "alLanguageExtension/$version"
12891289
if (!(Test-Path $path -PathType Container)) {
@@ -1312,8 +1312,7 @@ function RunAlTool {
13121312
Param(
13131313
[string[]] $arguments
13141314
)
1315-
# ALTOOL is at the moment only available in prerelease
1316-
$path = DownloadLatestAlLanguageExtension -allowPrerelease
1315+
$path = DownloadLatestAlLanguageExtension
13171316
if ($isLinux) {
13181317
$alToolExe = Join-Path $path 'extension/bin/linux/altool'
13191318
Write-Host "Setting execute permissions on altool"

Misc/Set-BcContainerFeatureKeys.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ $telemetryScope = InitTelemetryScope -name $MyInvocation.InvocationName -paramet
2626
try {
2727

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

TenantHandling/New-NavContainerTenant.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ try {
4646
throw "You cannot add a tenant called tenant"
4747
}
4848

49-
Invoke-ScriptInBcContainer -containerName $containerName -usePwsh:$false -ScriptBlock { Param($containerName, $tenantId, [PSCredential]$sqlCredential, $sourceDatabase, $destinationDatabase, $alternateId, $doNotCopyDatabase, $allowAppDatabaseWrite, $applicationInsightsKey)
49+
Invoke-ScriptInBcContainer -containerName $containerName -ScriptBlock { Param($containerName, $tenantId, [PSCredential]$sqlCredential, $sourceDatabase, $destinationDatabase, $alternateId, $doNotCopyDatabase, $allowAppDatabaseWrite, $applicationInsightsKey)
5050

5151
$customConfigFile = Join-Path (Get-Item "C:\Program Files\Microsoft Dynamics NAV\*\Service").FullName "CustomSettings.config"
5252
[xml]$customConfig = [System.IO.File]::ReadAllText($customConfigFile)

UserHandling/New-NavContainerNavUser.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ $telemetryScope = InitTelemetryScope -name $MyInvocation.InvocationName -paramet
5757
try {
5858
$navversion = Get-BcContainerNavversion -containerOrImageName $containerName
5959
$version = [System.Version]($navversion.split('-')[0])
60-
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)
60+
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)
6161

6262
$TenantParam = @{}
6363
if ($Tenant) {

0 commit comments

Comments
 (0)