From cde2e7d56d1b6d7a6cd46fa0793db9ebcec9d977 Mon Sep 17 00:00:00 2001 From: "Dariy.Nurgaleev" Date: Thu, 12 Mar 2020 21:22:54 +0700 Subject: [PATCH 01/49] added SQL Express install step --- .../scripts/Installers/Install-SQLExpress.ps1 | 20 +++++++++++++++++++ .../Installers/Validate-SQLExpress.ps1 | 15 ++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 images/win/scripts/Installers/Install-SQLExpress.ps1 create mode 100644 images/win/scripts/Installers/Validate-SQLExpress.ps1 diff --git a/images/win/scripts/Installers/Install-SQLExpress.ps1 b/images/win/scripts/Installers/Install-SQLExpress.ps1 new file mode 100644 index 00000000..4cb6deae --- /dev/null +++ b/images/win/scripts/Installers/Install-SQLExpress.ps1 @@ -0,0 +1,20 @@ +#Download web-installer +$installerUrl = "https://go.microsoft.com/fwlink/?linkid=866658" +$installerName = "SQL2019-SSEI-Expr.exe" +$installerPath = "${env:Temp}\$installerName" +Write-Host "Download web-installer" +(New-Object System.Net.WebClient).DownloadFile($installerUrl, $installerPath) +#use web-installer to download setup package +$downloadPath = "C:\SQLEXPRESS2019" +$setupPath = Join-Path $downloadPath "SQLEXPR_x64_ENU" +$downloadArgs = ("/MEDIAPATH=$downloadPath", "/MEDIATYPE=Core","/Action=Download", "/QUIET") +$installArgs = ("/Q", "/IACCEPTSQLSERVERLICENSETERMS") +$args = ("/Q", "/IACCEPTSQLSERVERLICENSETERMS", "/Action=Install", "/INSTANCEID=SQL2020", "/INSTANCENAME=SQL2020", "/SECURITYMODE=SQL", "/SAPWD=P@ssword!!", "/TCPENABLED=1") +Write-Host "Downloading SQL Express setup package" +Start-Process -FilePath $installerPath -ArgumentList $downloadArgs -Wait -PassThru +#Unpack and run setup-package +Set-Location -Path $downloadPath +Write-Host "Unpack SQL Express setup package" +Start-Process -FilePath "$setupPath.exe" -ArgumentList $installArgs -Wait -PassThru +Write-Host "Run SQL Express setup package" +Start-Process -FilePath "$setupPath/SETUP.exe" -ArgumentList $args -Wait -PassThru \ No newline at end of file diff --git a/images/win/scripts/Installers/Validate-SQLExpress.ps1 b/images/win/scripts/Installers/Validate-SQLExpress.ps1 new file mode 100644 index 00000000..8a0b78fd --- /dev/null +++ b/images/win/scripts/Installers/Validate-SQLExpress.ps1 @@ -0,0 +1,15 @@ +$sqlConn = New-Object System.Data.SqlClient.SqlConnection +$sqlConn.ConnectionString = "Server=$env:computername\SQL2019;Integrated Security=false;User ID=sa; Password=P@ssword!!" +$sqlConn.Open() +$str1="" +$sqlConn.State +IF (Compare-Object $sqlConn.State $str1) +{ +Write-Host "Failed attempt" +exit 1 +} +ELSE +{ +Write-Host "Success" +exit 0 +} \ No newline at end of file From a318add44ded8d5159ba96586efd4243f5598d53 Mon Sep 17 00:00:00 2001 From: "Dariy.Nurgaleev" Date: Thu, 12 Mar 2020 21:26:22 +0700 Subject: [PATCH 02/49] Added SQL Express installation --- images/win/Windows2019-Azure.json | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/images/win/Windows2019-Azure.json b/images/win/Windows2019-Azure.json index 8f82a6eb..732d417d 100644 --- a/images/win/Windows2019-Azure.json +++ b/images/win/Windows2019-Azure.json @@ -436,6 +436,12 @@ "{{ template_dir }}/scripts/Installers/Install-MysqlCli.ps1" ] }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Windows2019/Install-SQLExpress.ps1" + ] + }, { "type": "powershell", "scripts":[ @@ -574,6 +580,12 @@ "type": "windows-restart", "restart_timeout": "10m" }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-SQLExpress.ps1" + ] + }, { "type": "powershell", "scripts":[ From debb478679eee046a9b0a86c8daee750ea56f72f Mon Sep 17 00:00:00 2001 From: "Dariy.Nurgaleev" Date: Tue, 17 Mar 2020 01:28:14 +0700 Subject: [PATCH 03/49] SQLExpress installation full process --- images/win/Windows2016-Azure.json | 14 +++++++ images/win/Windows2019-Azure.json | 4 +- .../scripts/Installers/Install-SQLExpress.ps1 | 42 +++++++++++++++++-- 3 files changed, 55 insertions(+), 5 deletions(-) diff --git a/images/win/Windows2016-Azure.json b/images/win/Windows2016-Azure.json index fcb0ed4c..b4033529 100644 --- a/images/win/Windows2016-Azure.json +++ b/images/win/Windows2016-Azure.json @@ -296,6 +296,12 @@ "{{ template_dir }}/scripts/Installers/Install-Bazel.ps1" ] }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-SQLExpress.ps1" + ] + }, { "type": "powershell", "scripts":[ @@ -455,6 +461,14 @@ "{{ template_dir }}/scripts/Installers/Install-MysqlCli.ps1" ] }, + { + "type": "powershell", + "elevated_user": "SYSTEM", + "elevated_password": "", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-SQLExpress.ps1" + ] + }, { "type": "powershell", "scripts":[ diff --git a/images/win/Windows2019-Azure.json b/images/win/Windows2019-Azure.json index 732d417d..20711d80 100644 --- a/images/win/Windows2019-Azure.json +++ b/images/win/Windows2019-Azure.json @@ -438,8 +438,10 @@ }, { "type": "powershell", + "elevated_user": "SYSTEM", + "elevated_password": "", "scripts":[ - "{{ template_dir }}/scripts/Installers/Windows2019/Install-SQLExpress.ps1" + "{{ template_dir }}/scripts/Installers/Install-SQLExpress.ps1" ] }, { diff --git a/images/win/scripts/Installers/Install-SQLExpress.ps1 b/images/win/scripts/Installers/Install-SQLExpress.ps1 index 4cb6deae..70768729 100644 --- a/images/win/scripts/Installers/Install-SQLExpress.ps1 +++ b/images/win/scripts/Installers/Install-SQLExpress.ps1 @@ -1,4 +1,5 @@ #Download web-installer +Set-Item .\MaxMemoryPerShellMB 4096 $installerUrl = "https://go.microsoft.com/fwlink/?linkid=866658" $installerName = "SQL2019-SSEI-Expr.exe" $installerPath = "${env:Temp}\$installerName" @@ -9,12 +10,45 @@ $downloadPath = "C:\SQLEXPRESS2019" $setupPath = Join-Path $downloadPath "SQLEXPR_x64_ENU" $downloadArgs = ("/MEDIAPATH=$downloadPath", "/MEDIATYPE=Core","/Action=Download", "/QUIET") $installArgs = ("/Q", "/IACCEPTSQLSERVERLICENSETERMS") -$args = ("/Q", "/IACCEPTSQLSERVERLICENSETERMS", "/Action=Install", "/INSTANCEID=SQL2020", "/INSTANCENAME=SQL2020", "/SECURITYMODE=SQL", "/SAPWD=P@ssword!!", "/TCPENABLED=1") +$args = ("/c", "$setupPath/SETUP.exe", "/Q", "/IACCEPTSQLSERVERLICENSETERMS", "/Action=Install", "/INSTANCEID=SQL2019", "/INSTANCENAME=SQL2019", "/SECURITYMODE=SQL", "/SAPWD=P@ssword!!", "/TCPENABLED=1") Write-Host "Downloading SQL Express setup package" -Start-Process -FilePath $installerPath -ArgumentList $downloadArgs -Wait -PassThru +$process = Start-Process -FilePath $installerPath -ArgumentList $downloadArgs -Wait -PassThru +$exitCode = $process.ExitCode +if ($exitCode -eq 0) +{ + Write-Host -Object 'Downloaded successfully' + Write-Host $exitCode +} + else +{ + Write-Host -Object "Non zero exit code returned by the installation process : $exitCode." + exit $exitCode +} #Unpack and run setup-package Set-Location -Path $downloadPath Write-Host "Unpack SQL Express setup package" -Start-Process -FilePath "$setupPath.exe" -ArgumentList $installArgs -Wait -PassThru +$process = Start-Process -FilePath "$setupPath.exe" -ArgumentList $installArgs -Wait -PassThru +$exitCode = $process.ExitCode +if ($exitCode -eq 0) +{ + Write-Host -Object 'Unpacked successfully' + Write-Host $exitCode +} + else +{ + Write-Host -Object "Non zero exit code returned by the installation process : $exitCode." + Write-Host $exitCode +} Write-Host "Run SQL Express setup package" -Start-Process -FilePath "$setupPath/SETUP.exe" -ArgumentList $args -Wait -PassThru \ No newline at end of file +$process = Start-Process -FilePath cmd.exe -ArgumentList $args -Wait -PassThru +$exitCode = $process.ExitCode +if ($exitCode -eq 0) +{ + Write-Host -Object 'Installed successfully' + Write-Host $exitCode +} + else +{ + Write-Host -Object "Non zero exit code returned by the installation process : $exitCode." + exit $exitCode +} \ No newline at end of file From 1cb09f80a286be26220ea92eebd3a010b4032eb3 Mon Sep 17 00:00:00 2001 From: "Dariy.Nurgaleev" Date: Tue, 17 Mar 2020 21:47:47 +0700 Subject: [PATCH 04/49] re-worked SQLExpress installer --- .../scripts/Installers/Install-SQLExpress.ps1 | 89 ++++++++----------- 1 file changed, 39 insertions(+), 50 deletions(-) diff --git a/images/win/scripts/Installers/Install-SQLExpress.ps1 b/images/win/scripts/Installers/Install-SQLExpress.ps1 index 70768729..a732f86b 100644 --- a/images/win/scripts/Installers/Install-SQLExpress.ps1 +++ b/images/win/scripts/Installers/Install-SQLExpress.ps1 @@ -1,54 +1,43 @@ -#Download web-installer -Set-Item .\MaxMemoryPerShellMB 4096 +function Start-Task { + param( + [String]$InstallPath, + [String]$Arguments + ) + $process = Start-Process -FilePath $InstallPath -ArgumentList $Arguments -Wait -PassThru + $exitCode = $process.ExitCode +# Exit code -2067529716 is added since SQL Unpack procedure returns it on success. + if ($exitCode -eq 0 -or -2067529716) + { + Write-Host -Object "Success. Exit code: $exitCode." + } + else + { + Write-Host -Object "Non zero exit code returned by the installation process : $exitCode." + exit $exitCode + } +} + +function Start-DownloadSQLExpress { + param( + [String]$InstallerUrl, + [String]$InstallerPath + ) + Write-Host "Download web-installer" + (New-Object System.Net.WebClient).DownloadFile($InstallerUrl, $InstallerPath) +} + $installerUrl = "https://go.microsoft.com/fwlink/?linkid=866658" -$installerName = "SQL2019-SSEI-Expr.exe" -$installerPath = "${env:Temp}\$installerName" -Write-Host "Download web-installer" -(New-Object System.Net.WebClient).DownloadFile($installerUrl, $installerPath) -#use web-installer to download setup package +$installerPath = "${env:Temp}\SQL2019-SSEI-Expr.exe" $downloadPath = "C:\SQLEXPRESS2019" $setupPath = Join-Path $downloadPath "SQLEXPR_x64_ENU" $downloadArgs = ("/MEDIAPATH=$downloadPath", "/MEDIATYPE=Core","/Action=Download", "/QUIET") -$installArgs = ("/Q", "/IACCEPTSQLSERVERLICENSETERMS") -$args = ("/c", "$setupPath/SETUP.exe", "/Q", "/IACCEPTSQLSERVERLICENSETERMS", "/Action=Install", "/INSTANCEID=SQL2019", "/INSTANCENAME=SQL2019", "/SECURITYMODE=SQL", "/SAPWD=P@ssword!!", "/TCPENABLED=1") -Write-Host "Downloading SQL Express setup package" -$process = Start-Process -FilePath $installerPath -ArgumentList $downloadArgs -Wait -PassThru -$exitCode = $process.ExitCode -if ($exitCode -eq 0) -{ - Write-Host -Object 'Downloaded successfully' - Write-Host $exitCode -} - else -{ - Write-Host -Object "Non zero exit code returned by the installation process : $exitCode." - exit $exitCode -} -#Unpack and run setup-package -Set-Location -Path $downloadPath -Write-Host "Unpack SQL Express setup package" -$process = Start-Process -FilePath "$setupPath.exe" -ArgumentList $installArgs -Wait -PassThru -$exitCode = $process.ExitCode -if ($exitCode -eq 0) -{ - Write-Host -Object 'Unpacked successfully' - Write-Host $exitCode -} - else -{ - Write-Host -Object "Non zero exit code returned by the installation process : $exitCode." - Write-Host $exitCode -} -Write-Host "Run SQL Express setup package" -$process = Start-Process -FilePath cmd.exe -ArgumentList $args -Wait -PassThru -$exitCode = $process.ExitCode -if ($exitCode -eq 0) -{ - Write-Host -Object 'Installed successfully' - Write-Host $exitCode -} - else -{ - Write-Host -Object "Non zero exit code returned by the installation process : $exitCode." - exit $exitCode -} \ No newline at end of file +$unpackArgs = ("/Q", "/IACCEPTSQLSERVERLICENSETERMS") +$installArgs = ("/Q", "/IACCEPTSQLSERVERLICENSETERMS", "/Action=Install", "/INSTANCEID=SQL2019", "/INSTANCENAME=SQL2019", "/SECURITYMODE=SQL", "/SAPWD=P@ssword!!", "/TCPENABLED=1") +#Download installer for SQL Express +Start-DownloadSQLExpress -InstallerUrl $installerUrl -InstallerPath $installerPath +#Download full SQL Express package +Start-Task -InstallPath $installerPath -Arguments $downloadArgs +#Unpack SQL Express Installer +Start-Task -InstallPath "$setupPath.exe" -Arguments $unpackArgs +#Start SQL Express installer silently +Start-Task -InstallPath "$setupPath/SETUP.exe" -Arguments $installArgs \ No newline at end of file From 6b8ec803ad7352db49290b48f7c8c20cc51a583c Mon Sep 17 00:00:00 2001 From: "Dariy.Nurgaleev" Date: Tue, 17 Mar 2020 21:54:40 +0700 Subject: [PATCH 05/49] added messages --- images/win/scripts/Installers/Install-SQLExpress.ps1 | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/images/win/scripts/Installers/Install-SQLExpress.ps1 b/images/win/scripts/Installers/Install-SQLExpress.ps1 index a732f86b..113fe1e9 100644 --- a/images/win/scripts/Installers/Install-SQLExpress.ps1 +++ b/images/win/scripts/Installers/Install-SQLExpress.ps1 @@ -1,14 +1,15 @@ function Start-Task { param( [String]$InstallPath, - [String]$Arguments + [String]$Arguments, + [String]$SuccessMessage ) $process = Start-Process -FilePath $InstallPath -ArgumentList $Arguments -Wait -PassThru $exitCode = $process.ExitCode # Exit code -2067529716 is added since SQL Unpack procedure returns it on success. if ($exitCode -eq 0 -or -2067529716) { - Write-Host -Object "Success. Exit code: $exitCode." + Write-Host -Object "$SuccessMessage : ExitCode: $exitCode" } else { @@ -36,8 +37,8 @@ $installArgs = ("/Q", "/IACCEPTSQLSERVERLICENSETERMS", "/Action=Install", "/INST #Download installer for SQL Express Start-DownloadSQLExpress -InstallerUrl $installerUrl -InstallerPath $installerPath #Download full SQL Express package -Start-Task -InstallPath $installerPath -Arguments $downloadArgs +Start-Task -InstallPath $installerPath -Arguments $downloadArgs -SuccessMessage "Downloaded package from: $installerUrl . To path: $installerPath " #Unpack SQL Express Installer -Start-Task -InstallPath "$setupPath.exe" -Arguments $unpackArgs +Start-Task -InstallPath "$setupPath.exe" -Arguments $unpackArgs -SuccessMessage "Unpacked package to directory: $setupPath" #Start SQL Express installer silently -Start-Task -InstallPath "$setupPath/SETUP.exe" -Arguments $installArgs \ No newline at end of file +Start-Task -InstallPath "$setupPath/SETUP.exe" -Arguments $installArgs -SuccessMessage "SQL has been installed to directory: ${env:ProgramFiles}/Microsoft SQL Server" \ No newline at end of file From 3674469663a99e81d0ebfaadb8acdc7db5ec52b6 Mon Sep 17 00:00:00 2001 From: "Dariy.Nurgaleev" Date: Tue, 17 Mar 2020 21:56:27 +0700 Subject: [PATCH 06/49] added debug messages --- images/win/scripts/Installers/Install-SQLExpress.ps1 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/images/win/scripts/Installers/Install-SQLExpress.ps1 b/images/win/scripts/Installers/Install-SQLExpress.ps1 index 113fe1e9..c9bd3c8c 100644 --- a/images/win/scripts/Installers/Install-SQLExpress.ps1 +++ b/images/win/scripts/Installers/Install-SQLExpress.ps1 @@ -23,8 +23,9 @@ function Start-DownloadSQLExpress { [String]$InstallerUrl, [String]$InstallerPath ) - Write-Host "Download web-installer" + Write-Host "Download SQL Express web-installer from: $InstallerUrl" (New-Object System.Net.WebClient).DownloadFile($InstallerUrl, $InstallerPath) + Write-Host "SQL Express has been successfully downladed from the link: $InstallerUrl" } $installerUrl = "https://go.microsoft.com/fwlink/?linkid=866658" @@ -37,7 +38,7 @@ $installArgs = ("/Q", "/IACCEPTSQLSERVERLICENSETERMS", "/Action=Install", "/INST #Download installer for SQL Express Start-DownloadSQLExpress -InstallerUrl $installerUrl -InstallerPath $installerPath #Download full SQL Express package -Start-Task -InstallPath $installerPath -Arguments $downloadArgs -SuccessMessage "Downloaded package from: $installerUrl . To path: $installerPath " +Start-Task -InstallPath $installerPath -Arguments $downloadArgs -SuccessMessage "Downloaded full package. To path: $installerPath " #Unpack SQL Express Installer Start-Task -InstallPath "$setupPath.exe" -Arguments $unpackArgs -SuccessMessage "Unpacked package to directory: $setupPath" #Start SQL Express installer silently From a64115f034a2de1a3a3758b31c483d61df214641 Mon Sep 17 00:00:00 2001 From: "Dariy.Nurgaleev" Date: Tue, 17 Mar 2020 22:56:55 +0700 Subject: [PATCH 07/49] changed if statement --- images/win/scripts/Installers/Install-SQLExpress.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/images/win/scripts/Installers/Install-SQLExpress.ps1 b/images/win/scripts/Installers/Install-SQLExpress.ps1 index c9bd3c8c..74d51d80 100644 --- a/images/win/scripts/Installers/Install-SQLExpress.ps1 +++ b/images/win/scripts/Installers/Install-SQLExpress.ps1 @@ -7,7 +7,7 @@ function Start-Task { $process = Start-Process -FilePath $InstallPath -ArgumentList $Arguments -Wait -PassThru $exitCode = $process.ExitCode # Exit code -2067529716 is added since SQL Unpack procedure returns it on success. - if ($exitCode -eq 0 -or -2067529716) + if ($exitCode -eq 0 -or $exitCode -eq -2067529716) { Write-Host -Object "$SuccessMessage : ExitCode: $exitCode" } From 8354d1a3827c7483b010675f6b2e14abe349e21e Mon Sep 17 00:00:00 2001 From: "Dariy.Nurgaleev" Date: Tue, 17 Mar 2020 23:22:20 +0700 Subject: [PATCH 08/49] validation with function --- .../Installers/Validate-SQLExpress.ps1 | 46 +++++++++++++------ 1 file changed, 32 insertions(+), 14 deletions(-) diff --git a/images/win/scripts/Installers/Validate-SQLExpress.ps1 b/images/win/scripts/Installers/Validate-SQLExpress.ps1 index 8a0b78fd..db246910 100644 --- a/images/win/scripts/Installers/Validate-SQLExpress.ps1 +++ b/images/win/scripts/Installers/Validate-SQLExpress.ps1 @@ -1,15 +1,33 @@ -$sqlConn = New-Object System.Data.SqlClient.SqlConnection -$sqlConn.ConnectionString = "Server=$env:computername\SQL2019;Integrated Security=false;User ID=sa; Password=P@ssword!!" -$sqlConn.Open() -$str1="" -$sqlConn.State -IF (Compare-Object $sqlConn.State $str1) -{ -Write-Host "Failed attempt" -exit 1 +function Test-SqlConnection { + param( + [Parameter(Mandatory)] + [string]$ServerName, + + [Parameter(Mandatory)] + [string]$IntegratedSecurity, + + [Parameter(Mandatory)] + [string]$UserName, + + [Parameter(Mandatory)] + [string]$Password + ) + + $ErrorActionPreference = 'Stop' + + try { + $connectionString = 'Server={0};Integrated Security={1};User ID={2};Password={3}' -f $ServerName,$IntegratedSecurity,$UserName,$Password + Write-Host -Object "Trying to connect to SQL Express instance: $ServerName" + $sqlConnection = New-Object System.Data.SqlClient.SqlConnection $connectionString + $sqlConnection.Open() + Write-Host -Object "Connection to SQL Express was successful." + } catch { + Write-Host -Object "Connection to SQL Express cannot be established." + exit 1 + } finally { + ## Close the connection when we're done + $sqlConnection.Close() + } } -ELSE -{ -Write-Host "Success" -exit 0 -} \ No newline at end of file +$instanceName = "$env:computername\SQL2019" +Test-SqlConnection -ServerName $instanceName -IntegratedSecurity "false" -UserName "sa" -Password "P@ssword!!" \ No newline at end of file From 02154aad2e7967f6998f7afc63f09255dcc32a68 Mon Sep 17 00:00:00 2001 From: "Dariy.Nurgaleev" Date: Tue, 17 Mar 2020 23:46:14 +0700 Subject: [PATCH 09/49] added description for SQL Express scripts --- images/win/scripts/Installers/Install-SQLExpress.ps1 | 9 +++++++++ images/win/scripts/Installers/Validate-SQLExpress.ps1 | 6 +++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/images/win/scripts/Installers/Install-SQLExpress.ps1 b/images/win/scripts/Installers/Install-SQLExpress.ps1 index 74d51d80..735ee408 100644 --- a/images/win/scripts/Installers/Install-SQLExpress.ps1 +++ b/images/win/scripts/Installers/Install-SQLExpress.ps1 @@ -1,3 +1,12 @@ +################################################################################ +## File: Install-SQLExpress.ps1 +## Desc: Install SQL Express for Windows +## SQL Version: Microsoft SQL Express 2019 ( 15.00.2000 ) +## InstanceName: SQL2019 +## Username - sa +## Password - P@ssword!! +## Default path - C:\Program Files (x86)\Microsoft SQL Server +################################################################################ function Start-Task { param( [String]$InstallPath, diff --git a/images/win/scripts/Installers/Validate-SQLExpress.ps1 b/images/win/scripts/Installers/Validate-SQLExpress.ps1 index db246910..951e7048 100644 --- a/images/win/scripts/Installers/Validate-SQLExpress.ps1 +++ b/images/win/scripts/Installers/Validate-SQLExpress.ps1 @@ -1,3 +1,7 @@ +################################################################################ +## File: Validate-SQLExpress.ps1 +## Desc: Validate Microsoft SQL Express installation +################################################################################ function Test-SqlConnection { param( [Parameter(Mandatory)] @@ -20,7 +24,7 @@ function Test-SqlConnection { Write-Host -Object "Trying to connect to SQL Express instance: $ServerName" $sqlConnection = New-Object System.Data.SqlClient.SqlConnection $connectionString $sqlConnection.Open() - Write-Host -Object "Connection to SQL Express was successful." + Write-Host -Object "Connection to database: {0} in in was successful. Version of SQL Express is: {1}" -f $sqlConnection.Database,$sqlConnection.ServerVersion } catch { Write-Host -Object "Connection to SQL Express cannot be established." exit 1 From c279ba06642d90652a5552407e59020016a6ff4b Mon Sep 17 00:00:00 2001 From: "Dariy.Nurgaleev" Date: Wed, 18 Mar 2020 00:16:00 +0700 Subject: [PATCH 10/49] added software markdon --- .../scripts/Installers/Validate-SQLExpress.ps1 | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/images/win/scripts/Installers/Validate-SQLExpress.ps1 b/images/win/scripts/Installers/Validate-SQLExpress.ps1 index 951e7048..fc54a4d0 100644 --- a/images/win/scripts/Installers/Validate-SQLExpress.ps1 +++ b/images/win/scripts/Installers/Validate-SQLExpress.ps1 @@ -25,6 +25,7 @@ function Test-SqlConnection { $sqlConnection = New-Object System.Data.SqlClient.SqlConnection $connectionString $sqlConnection.Open() Write-Host -Object "Connection to database: {0} in in was successful. Version of SQL Express is: {1}" -f $sqlConnection.Database,$sqlConnection.ServerVersion + return $sqlConnection.ServerVersion } catch { Write-Host -Object "Connection to SQL Express cannot be established." exit 1 @@ -34,4 +35,17 @@ function Test-SqlConnection { } } $instanceName = "$env:computername\SQL2019" -Test-SqlConnection -ServerName $instanceName -IntegratedSecurity "false" -UserName "sa" -Password "P@ssword!!" \ No newline at end of file +$version = Test-SqlConnection -ServerName $instanceName -IntegratedSecurity "false" -UserName "sa" -Password "P@ssword!!" + +# Adding description of the software to Markdown +$SoftwareName = "Git" + +$Description = @" +_Version:_ $version
+_InstanceName:_ SQL2019
+_Username:_ sa
+_Password:_ P@ssword!!
+_Default Path:_ C:\Program Files (x86)\Microsoft SQL Server +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description From b2c676b3e30c4b522bdec951ca8c460107ce3b08 Mon Sep 17 00:00:00 2001 From: "Dariy.Nurgaleev" Date: Wed, 18 Mar 2020 00:22:02 +0700 Subject: [PATCH 11/49] changed comment for SQL Express install --- images/win/scripts/Installers/Install-SQLExpress.ps1 | 5 ----- 1 file changed, 5 deletions(-) diff --git a/images/win/scripts/Installers/Install-SQLExpress.ps1 b/images/win/scripts/Installers/Install-SQLExpress.ps1 index 735ee408..254d09bc 100644 --- a/images/win/scripts/Installers/Install-SQLExpress.ps1 +++ b/images/win/scripts/Installers/Install-SQLExpress.ps1 @@ -1,11 +1,6 @@ ################################################################################ ## File: Install-SQLExpress.ps1 ## Desc: Install SQL Express for Windows -## SQL Version: Microsoft SQL Express 2019 ( 15.00.2000 ) -## InstanceName: SQL2019 -## Username - sa -## Password - P@ssword!! -## Default path - C:\Program Files (x86)\Microsoft SQL Server ################################################################################ function Start-Task { param( From 81872a6a71eed002eda446b20630d0098a2cad33 Mon Sep 17 00:00:00 2001 From: "Dariy.Nurgaleev" Date: Wed, 18 Mar 2020 00:46:51 +0700 Subject: [PATCH 12/49] added retry logic for download --- .../scripts/Installers/Install-SQLExpress.ps1 | 33 +++++++++++++++++-- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/images/win/scripts/Installers/Install-SQLExpress.ps1 b/images/win/scripts/Installers/Install-SQLExpress.ps1 index 254d09bc..2834371e 100644 --- a/images/win/scripts/Installers/Install-SQLExpress.ps1 +++ b/images/win/scripts/Installers/Install-SQLExpress.ps1 @@ -25,10 +25,37 @@ function Start-Task { function Start-DownloadSQLExpress { param( [String]$InstallerUrl, - [String]$InstallerPath + [String]$InstallerPath, + [int] $retries = 10 ) - Write-Host "Download SQL Express web-installer from: $InstallerUrl" - (New-Object System.Net.WebClient).DownloadFile($InstallerUrl, $InstallerPath) + Write-Host "Downloading SQL Express web-installer from: $InstallerUrl" + # In case of any errors -try to download package several times + while($retries -gt 0) + { + try + { + Write-Host "Downloading SQL Express installer..." + (New-Object System.Net.WebClient).DownloadFile($InstallerUrl, $InstallerPath) + break + } + catch + { + Write-Host "There is an error during SQL Express downloading" + $_ + + $retries-- + + if ($retries -eq 0) + { + Write-Host "File can't be downloaded" + $_ + exit 1 + } + + Write-Host "Waiting 30 seconds before retrying. Retries left: $retries" + Start-Sleep -Seconds 30 + } + } Write-Host "SQL Express has been successfully downladed from the link: $InstallerUrl" } From 89b21c86936b71c89e78d6a69d84b0293c8afaf9 Mon Sep 17 00:00:00 2001 From: "Dariy.Nurgaleev" Date: Thu, 19 Mar 2020 01:21:50 +0700 Subject: [PATCH 13/49] changed validation in 2016 --- images/win/Windows2016-Azure.json | 12 ++++++------ images/win/Windows2019-Azure.json | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/images/win/Windows2016-Azure.json b/images/win/Windows2016-Azure.json index b4033529..df58ba84 100644 --- a/images/win/Windows2016-Azure.json +++ b/images/win/Windows2016-Azure.json @@ -296,12 +296,6 @@ "{{ template_dir }}/scripts/Installers/Install-Bazel.ps1" ] }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-SQLExpress.ps1" - ] - }, { "type": "powershell", "scripts":[ @@ -732,6 +726,12 @@ "{{ template_dir }}/scripts/Installers/Validate-Bazel.ps1" ] }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-SQLExpress.ps1" + ] + }, { "type": "powershell", "scripts":[ diff --git a/images/win/Windows2019-Azure.json b/images/win/Windows2019-Azure.json index 20711d80..7e7df234 100644 --- a/images/win/Windows2019-Azure.json +++ b/images/win/Windows2019-Azure.json @@ -582,12 +582,6 @@ "type": "windows-restart", "restart_timeout": "10m" }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-SQLExpress.ps1" - ] - }, { "type": "powershell", "scripts":[ @@ -743,6 +737,12 @@ "{{ template_dir }}/scripts/Installers/Validate-MysqlCli.ps1" ] }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-SQLExpress.ps1" + ] + }, { "type": "powershell", "scripts":[ From 66c53c10652ecc041896e55c36c613599260032d Mon Sep 17 00:00:00 2001 From: "Dariy.Nurgaleev" Date: Thu, 19 Mar 2020 01:36:41 +0700 Subject: [PATCH 14/49] added parameters for validation. --- .../Installers/Validate-SQLExpress.ps1 | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/images/win/scripts/Installers/Validate-SQLExpress.ps1 b/images/win/scripts/Installers/Validate-SQLExpress.ps1 index fc54a4d0..106a5b7d 100644 --- a/images/win/scripts/Installers/Validate-SQLExpress.ps1 +++ b/images/win/scripts/Installers/Validate-SQLExpress.ps1 @@ -2,29 +2,30 @@ ## File: Validate-SQLExpress.ps1 ## Desc: Validate Microsoft SQL Express installation ################################################################################ + +#Parameters for database access +$sqlUser = "sa" +$sqlPassword = "P@ssword!!" +$sqlInstance = "SQL2019" + function Test-SqlConnection { param( [Parameter(Mandatory)] [string]$ServerName, - [Parameter(Mandatory)] [string]$IntegratedSecurity, - [Parameter(Mandatory)] [string]$UserName, - [Parameter(Mandatory)] [string]$Password ) - $ErrorActionPreference = 'Stop' - try { $connectionString = 'Server={0};Integrated Security={1};User ID={2};Password={3}' -f $ServerName,$IntegratedSecurity,$UserName,$Password Write-Host -Object "Trying to connect to SQL Express instance: $ServerName" $sqlConnection = New-Object System.Data.SqlClient.SqlConnection $connectionString $sqlConnection.Open() - Write-Host -Object "Connection to database: {0} in in was successful. Version of SQL Express is: {1}" -f $sqlConnection.Database,$sqlConnection.ServerVersion + Write-Host -Object "Connection to database: {0} was successful. Version of SQL Express is: {1}" -f $sqlConnection.Database,$sqlConnection.ServerVersion return $sqlConnection.ServerVersion } catch { Write-Host -Object "Connection to SQL Express cannot be established." @@ -34,17 +35,16 @@ function Test-SqlConnection { $sqlConnection.Close() } } -$instanceName = "$env:computername\SQL2019" -$version = Test-SqlConnection -ServerName $instanceName -IntegratedSecurity "false" -UserName "sa" -Password "P@ssword!!" +$instanceName = "$env:computername\$sqlInstance" +$version = Test-SqlConnection -ServerName $instanceName -IntegratedSecurity "false" -UserName $sqlUser -Password $sqlPassword # Adding description of the software to Markdown $SoftwareName = "Git" - $Description = @" _Version:_ $version
-_InstanceName:_ SQL2019
-_Username:_ sa
-_Password:_ P@ssword!!
+_InstanceName:_ $sqlInstance
+_Username:_ $sqlUser
+_Password:_ $sqlPassword
_Default Path:_ C:\Program Files (x86)\Microsoft SQL Server "@ From 7bc1e5494f631d7f49b6ad007c162ff2bfbe96bc Mon Sep 17 00:00:00 2001 From: "Dariy.Nurgaleev" Date: Thu, 19 Mar 2020 01:56:11 +0700 Subject: [PATCH 15/49] created separate functions for each step. --- .../scripts/Installers/Install-SQLExpress.ps1 | 62 +++++++++++++++---- 1 file changed, 50 insertions(+), 12 deletions(-) diff --git a/images/win/scripts/Installers/Install-SQLExpress.ps1 b/images/win/scripts/Installers/Install-SQLExpress.ps1 index 2834371e..d39f4f7b 100644 --- a/images/win/scripts/Installers/Install-SQLExpress.ps1 +++ b/images/win/scripts/Installers/Install-SQLExpress.ps1 @@ -2,26 +2,65 @@ ## File: Install-SQLExpress.ps1 ## Desc: Install SQL Express for Windows ################################################################################ -function Start-Task { + +function Download-FullSQLPackage { + param( + [String]$InstallerPath, + [String]$Arguments = ("/MEDIAPATH=$downloadPath", "/MEDIATYPE=Core","/Action=Download", "/QUIET") + ) + $process = Start-Process -FilePath $InstallerPath -ArgumentList $Arguments -Wait -PassThru + $exitCode = $process.ExitCode +# Exit code -2067529716 is added since SQL Unpack procedure returns it on success. + if ($exitCode -eq 0) + { + Write-Host -Object "Full SQL Express package has been successfully downloaded to $InstallerPath : ExitCode: $exitCode" + } + else + { + Write-Host -Object "Full package downloading process was unsuccessful. Exit code: $exitCode." + exit $exitCode + } +} + +function Unpack-SQLInstaller { param( [String]$InstallPath, - [String]$Arguments, - [String]$SuccessMessage + [String]$Arguments = ("/Q", "/IACCEPTSQLSERVERLICENSETERMS") ) $process = Start-Process -FilePath $InstallPath -ArgumentList $Arguments -Wait -PassThru $exitCode = $process.ExitCode # Exit code -2067529716 is added since SQL Unpack procedure returns it on success. if ($exitCode -eq 0 -or $exitCode -eq -2067529716) { - Write-Host -Object "$SuccessMessage : ExitCode: $exitCode" + Write-Host -Object "SQL installer unpacking has been completed." } else { - Write-Host -Object "Non zero exit code returned by the installation process : $exitCode." + Write-Host -Object "SQL installer unpacking was interrupted : $exitCode." exit $exitCode } } +function Start-Installer { + param( + [String]$InstallPath, + [String]$Arguments = ("/Q", "/IACCEPTSQLSERVERLICENSETERMS", "/Action=Install", "/INSTANCEID=SQL2019", "/INSTANCENAME=SQL2019", "/SECURITYMODE=SQL", "/SAPWD=P@ssword!!", "/TCPENABLED=1") + ) + $process = Start-Process -FilePath $InstallPath -ArgumentList $Arguments -Wait -PassThru + $exitCode = $process.ExitCode +# Exit code -2067529716 is added since SQL Unpack procedure returns it on success. + if ($exitCode -eq 0) + { + Write-Host -Object "SQL Express has been successfully installed: ExitCode: $exitCode" + } + else + { + Write-Host -Object "Installation procedure was not correctly completed. Exit code: $exitCode." + exit $exitCode + } +} + + function Start-DownloadSQLExpress { param( [String]$InstallerUrl, @@ -58,19 +97,18 @@ function Start-DownloadSQLExpress { } Write-Host "SQL Express has been successfully downladed from the link: $InstallerUrl" } - +#default variables for functions. $installerUrl = "https://go.microsoft.com/fwlink/?linkid=866658" $installerPath = "${env:Temp}\SQL2019-SSEI-Expr.exe" $downloadPath = "C:\SQLEXPRESS2019" $setupPath = Join-Path $downloadPath "SQLEXPR_x64_ENU" -$downloadArgs = ("/MEDIAPATH=$downloadPath", "/MEDIATYPE=Core","/Action=Download", "/QUIET") -$unpackArgs = ("/Q", "/IACCEPTSQLSERVERLICENSETERMS") -$installArgs = ("/Q", "/IACCEPTSQLSERVERLICENSETERMS", "/Action=Install", "/INSTANCEID=SQL2019", "/INSTANCENAME=SQL2019", "/SECURITYMODE=SQL", "/SAPWD=P@ssword!!", "/TCPENABLED=1") +#Set default location for proper script execution +Set-Location -Path $downloadPath #Download installer for SQL Express Start-DownloadSQLExpress -InstallerUrl $installerUrl -InstallerPath $installerPath #Download full SQL Express package -Start-Task -InstallPath $installerPath -Arguments $downloadArgs -SuccessMessage "Downloaded full package. To path: $installerPath " +Download-FullSQLPackage -InstallerPath $installerPath #Unpack SQL Express Installer -Start-Task -InstallPath "$setupPath.exe" -Arguments $unpackArgs -SuccessMessage "Unpacked package to directory: $setupPath" +Unpack-SQLInstaller -InstallPath "$setupPath.exe" #Start SQL Express installer silently -Start-Task -InstallPath "$setupPath/SETUP.exe" -Arguments $installArgs -SuccessMessage "SQL has been installed to directory: ${env:ProgramFiles}/Microsoft SQL Server" \ No newline at end of file +Start-Installer -InstallPath "$setupPath/SETUP.exe" \ No newline at end of file From 09ce7185499f7587f6e6cfb941ec65391e13ee99 Mon Sep 17 00:00:00 2001 From: "Dariy.Nurgaleev" Date: Thu, 19 Mar 2020 02:38:23 +0700 Subject: [PATCH 16/49] added Start-DownloadWithRetry function --- .../scripts/ImageHelpers/InstallHelpers.ps1 | 166 +++++++++++++++++- 1 file changed, 165 insertions(+), 1 deletion(-) diff --git a/images/win/scripts/ImageHelpers/InstallHelpers.ps1 b/images/win/scripts/ImageHelpers/InstallHelpers.ps1 index f6c553b2..201dea86 100644 --- a/images/win/scripts/ImageHelpers/InstallHelpers.ps1 +++ b/images/win/scripts/ImageHelpers/InstallHelpers.ps1 @@ -161,7 +161,134 @@ Hashtable for service arguments } } -function Get-VS19ExtensionVersion + +function Start-DownloadWithRetry +{ + param ( + [Parameter(Mandatory)] + [string] $Url, + [string] $FullFilePath = "${env:Temp}\Default.exe", + [int] $retries = 20 + ) + #Default retry logic for the package. + while($retries -gt 0) + { + try + { + Write-Host "Downloading package from: $Url to path $FilePath ." + (New-Object System.Net.WebClient).DownloadFile($Url, $FilePath) + break + } + catch + { + Write-Host "There is an error during package downloading" + $_ + + $retries-- + + if ($retries -eq 0) + { + Write-Host "File can't be downloaded. Please try later or check that file exists by url: $Url" + $_ + exit 1 + } + + Write-Host "Waiting 30 seconds before retrying. Retries left: $retries" + Start-Sleep -Seconds 30 + } + } + return $FullFilePath +} + + +function Install-VsixExtension +{ + Param + ( + [string] $Url, + [Parameter(Mandatory = $true)] + [string] $Name, + [string] $FilePath, + [Parameter(Mandatory = $true)] + [string] $VSversion, + [int] $retries = 20, + [switch] $InstallOnly + ) + + if (!$InstallOnly) + { + $FilePath = "${env:Temp}\$Name" + + while($retries -gt 0) + { + try + { + Write-Host "Downloading $Name..." + (New-Object System.Net.WebClient).DownloadFile($Url, $FilePath) + break + } + catch + { + Write-Host "There is an error during $Name downloading" + $_ + + $retries-- + + if ($retries -eq 0) + { + Write-Host "File can't be downloaded" + $_ + exit 1 + } + + Write-Host "Waiting 30 seconds before retrying. Retries left: $retries" + Start-Sleep -Seconds 30 + } + } + } + + $ArgumentList = ('/quiet', "`"$FilePath`"") + + Write-Host "Starting Install $Name..." + try + { + #There are 2 types of packages at the moment - exe and vsix + if ($Name -match "vsix") + { + $process = Start-Process -FilePath "C:\Program Files (x86)\Microsoft Visual Studio\$VSversion\Enterprise\Common7\IDE\VSIXInstaller.exe" -ArgumentList $ArgumentList -Wait -PassThru + } + else + { + $process = Start-Process -FilePath ${env:Temp}\$Name /Q -Wait -PassThru + } + } + catch + { + Write-Host "There is an error during $Name installation" + $_ + exit 1 + } + + $exitCode = $process.ExitCode + + if ($exitCode -eq 0 -or $exitCode -eq 1001) # 1001 means the extension is already installed + { + Write-Host "$Name installed successfully" + } + else + { + Write-Host "Unsuccessful exit code returned by the installation process: $exitCode." + exit 1 + } + + #Cleanup downloaded installation files + if (!$InstallOnly) + { + Remove-Item -Force -Confirm:$false $FilePath + } +} + +function Get-VSExtensionVersion { param ( [string] [Parameter(Mandatory=$true)] $packageName @@ -187,3 +314,40 @@ function Get-VS19ExtensionVersion return $packageVersion } + + +function Get-ToolcachePackages { + $toolcachePath = Join-Path $env:ROOT_FOLDER "toolcache.json" + Get-Content -Raw $toolcachePath | ConvertFrom-Json +} + +function Get-ToolsByName { + param ( + [Parameter(Mandatory = $True)] + [string]$SoftwareName + ) + + (Get-ToolcachePackages).PSObject.Properties | Where-Object { $_.Name -match $SoftwareName } | ForEach-Object { + $packageNameParts = $_.Name.Split("-") + [PSCustomObject] @{ + ToolName = $packageNameParts[1] + Versions = $_.Value + Architecture = $packageNameParts[3,4] -join "-" + } + } +} + +function Get-WinVersion +{ + (Get-WmiObject -class Win32_OperatingSystem).Caption +} + +function Test-IsWin19 +{ + (Get-WinVersion) -match "2019" +} + +function Test-IsWin16 +{ + (Get-WinVersion) -match "2016" +} From 7803da6806396147030efb7e2ed881cebd90cfef Mon Sep 17 00:00:00 2001 From: "Dariy.Nurgaleev" Date: Thu, 19 Mar 2020 18:15:11 +0700 Subject: [PATCH 17/49] added DownloadWithRetry function --- .../scripts/ImageHelpers/InstallHelpers.ps1 | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/images/win/scripts/ImageHelpers/InstallHelpers.ps1 b/images/win/scripts/ImageHelpers/InstallHelpers.ps1 index 201dea86..5ce11ded 100644 --- a/images/win/scripts/ImageHelpers/InstallHelpers.ps1 +++ b/images/win/scripts/ImageHelpers/InstallHelpers.ps1 @@ -161,15 +161,17 @@ Hashtable for service arguments } } - function Start-DownloadWithRetry { param ( - [Parameter(Mandatory)] - [string] $Url, - [string] $FullFilePath = "${env:Temp}\Default.exe", - [int] $retries = 20 - ) + [Parameter(Mandatory)] + [string] $Url, + [string] $DownloadPath = "${env:Temp}", + [Parameter(Mandatory)] + [string] $Name, + [int] $retries = 20 + ) + $FilePath = Join-Path $DownloadPath "\" $Name #Default retry logic for the package. while($retries -gt 0) { @@ -183,7 +185,6 @@ function Start-DownloadWithRetry { Write-Host "There is an error during package downloading" $_ - $retries-- if ($retries -eq 0) @@ -192,12 +193,11 @@ function Start-DownloadWithRetry $_ exit 1 } - Write-Host "Waiting 30 seconds before retrying. Retries left: $retries" Start-Sleep -Seconds 30 } } - return $FullFilePath + return $FilePath } From 71dfd431bdb84841425601f81c44b02644437ec5 Mon Sep 17 00:00:00 2001 From: "Dariy.Nurgaleev" Date: Thu, 19 Mar 2020 18:48:52 +0700 Subject: [PATCH 18/49] added DownloadWithRetry function --- .../scripts/Installers/Install-SQLExpress.ps1 | 41 +------------------ 1 file changed, 2 insertions(+), 39 deletions(-) diff --git a/images/win/scripts/Installers/Install-SQLExpress.ps1 b/images/win/scripts/Installers/Install-SQLExpress.ps1 index d39f4f7b..ed6a6606 100644 --- a/images/win/scripts/Installers/Install-SQLExpress.ps1 +++ b/images/win/scripts/Installers/Install-SQLExpress.ps1 @@ -2,6 +2,7 @@ ## File: Install-SQLExpress.ps1 ## Desc: Install SQL Express for Windows ################################################################################ +Import-Module -Name ImageHelpers -Force; function Download-FullSQLPackage { param( @@ -60,52 +61,14 @@ function Start-Installer { } } - -function Start-DownloadSQLExpress { - param( - [String]$InstallerUrl, - [String]$InstallerPath, - [int] $retries = 10 - ) - Write-Host "Downloading SQL Express web-installer from: $InstallerUrl" - # In case of any errors -try to download package several times - while($retries -gt 0) - { - try - { - Write-Host "Downloading SQL Express installer..." - (New-Object System.Net.WebClient).DownloadFile($InstallerUrl, $InstallerPath) - break - } - catch - { - Write-Host "There is an error during SQL Express downloading" - $_ - - $retries-- - - if ($retries -eq 0) - { - Write-Host "File can't be downloaded" - $_ - exit 1 - } - - Write-Host "Waiting 30 seconds before retrying. Retries left: $retries" - Start-Sleep -Seconds 30 - } - } - Write-Host "SQL Express has been successfully downladed from the link: $InstallerUrl" -} #default variables for functions. $installerUrl = "https://go.microsoft.com/fwlink/?linkid=866658" -$installerPath = "${env:Temp}\SQL2019-SSEI-Expr.exe" $downloadPath = "C:\SQLEXPRESS2019" $setupPath = Join-Path $downloadPath "SQLEXPR_x64_ENU" #Set default location for proper script execution Set-Location -Path $downloadPath #Download installer for SQL Express -Start-DownloadSQLExpress -InstallerUrl $installerUrl -InstallerPath $installerPath +$installerPath = Start-DownloadWithRetry -Url "https://go.microsoft.com/fwlink/?linkid=866658" -Name SQL2019-SSEI-Expr.exe #Download full SQL Express package Download-FullSQLPackage -InstallerPath $installerPath #Unpack SQL Express Installer From b4471d81b0345c3a8df4712e180822a935e8eb18 Mon Sep 17 00:00:00 2001 From: "Dariy.Nurgaleev" Date: Thu, 19 Mar 2020 18:53:27 +0700 Subject: [PATCH 19/49] added new parameter for Unpack function --- images/win/scripts/Installers/Install-SQLExpress.ps1 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/images/win/scripts/Installers/Install-SQLExpress.ps1 b/images/win/scripts/Installers/Install-SQLExpress.ps1 index ed6a6606..68e8a210 100644 --- a/images/win/scripts/Installers/Install-SQLExpress.ps1 +++ b/images/win/scripts/Installers/Install-SQLExpress.ps1 @@ -7,7 +7,8 @@ Import-Module -Name ImageHelpers -Force; function Download-FullSQLPackage { param( [String]$InstallerPath, - [String]$Arguments = ("/MEDIAPATH=$downloadPath", "/MEDIATYPE=Core","/Action=Download", "/QUIET") + [String]$DestinationPath, + [String]$Arguments = ("/MEDIAPATH=$DestinationPath", "/MEDIATYPE=Core","/Action=Download", "/QUIET") ) $process = Start-Process -FilePath $InstallerPath -ArgumentList $Arguments -Wait -PassThru $exitCode = $process.ExitCode @@ -70,7 +71,7 @@ Set-Location -Path $downloadPath #Download installer for SQL Express $installerPath = Start-DownloadWithRetry -Url "https://go.microsoft.com/fwlink/?linkid=866658" -Name SQL2019-SSEI-Expr.exe #Download full SQL Express package -Download-FullSQLPackage -InstallerPath $installerPath +Download-FullSQLPackage -InstallerPath $installerPath -DestinationPath $downloadPath #Unpack SQL Express Installer Unpack-SQLInstaller -InstallPath "$setupPath.exe" #Start SQL Express installer silently From 1316969c5207109a22cca14a2a86922fb77dfd6d Mon Sep 17 00:00:00 2001 From: "Dariy.Nurgaleev" Date: Thu, 19 Mar 2020 18:57:35 +0700 Subject: [PATCH 20/49] moved all installation packages to Temp folder --- images/win/scripts/Installers/Install-SQLExpress.ps1 | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/images/win/scripts/Installers/Install-SQLExpress.ps1 b/images/win/scripts/Installers/Install-SQLExpress.ps1 index 68e8a210..292b65b2 100644 --- a/images/win/scripts/Installers/Install-SQLExpress.ps1 +++ b/images/win/scripts/Installers/Install-SQLExpress.ps1 @@ -7,8 +7,7 @@ Import-Module -Name ImageHelpers -Force; function Download-FullSQLPackage { param( [String]$InstallerPath, - [String]$DestinationPath, - [String]$Arguments = ("/MEDIAPATH=$DestinationPath", "/MEDIATYPE=Core","/Action=Download", "/QUIET") + [String]$Arguments = ("/MEDIAPATH=${env:Temp}", "/MEDIATYPE=Core","/Action=Download", "/QUIET") ) $process = Start-Process -FilePath $InstallerPath -ArgumentList $Arguments -Wait -PassThru $exitCode = $process.ExitCode @@ -64,14 +63,14 @@ function Start-Installer { #default variables for functions. $installerUrl = "https://go.microsoft.com/fwlink/?linkid=866658" -$downloadPath = "C:\SQLEXPRESS2019" +$downloadPath = "${env:Temp}" $setupPath = Join-Path $downloadPath "SQLEXPR_x64_ENU" #Set default location for proper script execution Set-Location -Path $downloadPath #Download installer for SQL Express $installerPath = Start-DownloadWithRetry -Url "https://go.microsoft.com/fwlink/?linkid=866658" -Name SQL2019-SSEI-Expr.exe #Download full SQL Express package -Download-FullSQLPackage -InstallerPath $installerPath -DestinationPath $downloadPath +Download-FullSQLPackage -InstallerPath $installerPath #Unpack SQL Express Installer Unpack-SQLInstaller -InstallPath "$setupPath.exe" #Start SQL Express installer silently From 8875bb35856101c32cfd18e8e0dde671b4cae000 Mon Sep 17 00:00:00 2001 From: "Dariy.Nurgaleev" Date: Thu, 19 Mar 2020 19:00:16 +0700 Subject: [PATCH 21/49] removed unnecessary comments from code. --- images/win/scripts/Installers/Install-SQLExpress.ps1 | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/images/win/scripts/Installers/Install-SQLExpress.ps1 b/images/win/scripts/Installers/Install-SQLExpress.ps1 index 292b65b2..693c9303 100644 --- a/images/win/scripts/Installers/Install-SQLExpress.ps1 +++ b/images/win/scripts/Installers/Install-SQLExpress.ps1 @@ -11,7 +11,6 @@ function Download-FullSQLPackage { ) $process = Start-Process -FilePath $InstallerPath -ArgumentList $Arguments -Wait -PassThru $exitCode = $process.ExitCode -# Exit code -2067529716 is added since SQL Unpack procedure returns it on success. if ($exitCode -eq 0) { Write-Host -Object "Full SQL Express package has been successfully downloaded to $InstallerPath : ExitCode: $exitCode" @@ -49,7 +48,6 @@ function Start-Installer { ) $process = Start-Process -FilePath $InstallPath -ArgumentList $Arguments -Wait -PassThru $exitCode = $process.ExitCode -# Exit code -2067529716 is added since SQL Unpack procedure returns it on success. if ($exitCode -eq 0) { Write-Host -Object "SQL Express has been successfully installed: ExitCode: $exitCode" @@ -60,18 +58,13 @@ function Start-Installer { exit $exitCode } } - -#default variables for functions. $installerUrl = "https://go.microsoft.com/fwlink/?linkid=866658" $downloadPath = "${env:Temp}" $setupPath = Join-Path $downloadPath "SQLEXPR_x64_ENU" -#Set default location for proper script execution +#Set default location for installation process Set-Location -Path $downloadPath -#Download installer for SQL Express +#Download installer for SQL Express and return path to it $installerPath = Start-DownloadWithRetry -Url "https://go.microsoft.com/fwlink/?linkid=866658" -Name SQL2019-SSEI-Expr.exe -#Download full SQL Express package Download-FullSQLPackage -InstallerPath $installerPath -#Unpack SQL Express Installer Unpack-SQLInstaller -InstallPath "$setupPath.exe" -#Start SQL Express installer silently Start-Installer -InstallPath "$setupPath/SETUP.exe" \ No newline at end of file From 6d42c04772c6cf17c9e2cbfabed09f020749b0cc Mon Sep 17 00:00:00 2001 From: "Dariy.Nurgaleev" Date: Fri, 20 Mar 2020 00:26:46 +0700 Subject: [PATCH 22/49] InstallHelpers has been reworled with new function --- images/win/scripts/ImageHelpers/InstallHelpers.ps1 | 7 ------- 1 file changed, 7 deletions(-) diff --git a/images/win/scripts/ImageHelpers/InstallHelpers.ps1 b/images/win/scripts/ImageHelpers/InstallHelpers.ps1 index 0f965f74..5ce11ded 100644 --- a/images/win/scripts/ImageHelpers/InstallHelpers.ps1 +++ b/images/win/scripts/ImageHelpers/InstallHelpers.ps1 @@ -161,7 +161,6 @@ Hashtable for service arguments } } -<<<<<<< HEAD function Start-DownloadWithRetry { param ( @@ -202,8 +201,6 @@ function Start-DownloadWithRetry } -======= ->>>>>>> upstream/master function Install-VsixExtension { Param @@ -354,7 +351,3 @@ function Test-IsWin16 { (Get-WinVersion) -match "2016" } -<<<<<<< HEAD -======= - ->>>>>>> upstream/master From 33fd9bde2ea2ab0311a27f0d2a31d374190ea37e Mon Sep 17 00:00:00 2001 From: "Dariy.Nurgaleev" Date: Fri, 20 Mar 2020 00:28:25 +0700 Subject: [PATCH 23/49] added some unneccesary things --- images/win/scripts/Installers/Install-SQLExpress.ps1 | 2 -- images/win/scripts/Installers/Validate-SQLExpress.ps1 | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/images/win/scripts/Installers/Install-SQLExpress.ps1 b/images/win/scripts/Installers/Install-SQLExpress.ps1 index 693c9303..016dcd7c 100644 --- a/images/win/scripts/Installers/Install-SQLExpress.ps1 +++ b/images/win/scripts/Installers/Install-SQLExpress.ps1 @@ -61,9 +61,7 @@ function Start-Installer { $installerUrl = "https://go.microsoft.com/fwlink/?linkid=866658" $downloadPath = "${env:Temp}" $setupPath = Join-Path $downloadPath "SQLEXPR_x64_ENU" -#Set default location for installation process Set-Location -Path $downloadPath -#Download installer for SQL Express and return path to it $installerPath = Start-DownloadWithRetry -Url "https://go.microsoft.com/fwlink/?linkid=866658" -Name SQL2019-SSEI-Expr.exe Download-FullSQLPackage -InstallerPath $installerPath Unpack-SQLInstaller -InstallPath "$setupPath.exe" diff --git a/images/win/scripts/Installers/Validate-SQLExpress.ps1 b/images/win/scripts/Installers/Validate-SQLExpress.ps1 index 106a5b7d..ddb4ca3f 100644 --- a/images/win/scripts/Installers/Validate-SQLExpress.ps1 +++ b/images/win/scripts/Installers/Validate-SQLExpress.ps1 @@ -27,9 +27,11 @@ function Test-SqlConnection { $sqlConnection.Open() Write-Host -Object "Connection to database: {0} was successful. Version of SQL Express is: {1}" -f $sqlConnection.Database,$sqlConnection.ServerVersion return $sqlConnection.ServerVersion + } catch { Write-Host -Object "Connection to SQL Express cannot be established." exit 1 + } finally { ## Close the connection when we're done $sqlConnection.Close() From 1efd5a626fffa3a288dc3f6699d36ab357b1e0c4 Mon Sep 17 00:00:00 2001 From: "Dariy.Nurgaleev" Date: Fri, 20 Mar 2020 01:54:56 +0700 Subject: [PATCH 24/49] small fixes --- images/win/scripts/ImageHelpers/InstallHelpers.ps1 | 2 +- images/win/scripts/Installers/Install-SQLExpress.ps1 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/images/win/scripts/ImageHelpers/InstallHelpers.ps1 b/images/win/scripts/ImageHelpers/InstallHelpers.ps1 index 5ce11ded..910fbe5c 100644 --- a/images/win/scripts/ImageHelpers/InstallHelpers.ps1 +++ b/images/win/scripts/ImageHelpers/InstallHelpers.ps1 @@ -171,7 +171,7 @@ function Start-DownloadWithRetry [string] $Name, [int] $retries = 20 ) - $FilePath = Join-Path $DownloadPath "\" $Name + $FilePath = Join-Path $DownloadPath $Name #Default retry logic for the package. while($retries -gt 0) { diff --git a/images/win/scripts/Installers/Install-SQLExpress.ps1 b/images/win/scripts/Installers/Install-SQLExpress.ps1 index 016dcd7c..68c56470 100644 --- a/images/win/scripts/Installers/Install-SQLExpress.ps1 +++ b/images/win/scripts/Installers/Install-SQLExpress.ps1 @@ -62,7 +62,7 @@ $installerUrl = "https://go.microsoft.com/fwlink/?linkid=866658" $downloadPath = "${env:Temp}" $setupPath = Join-Path $downloadPath "SQLEXPR_x64_ENU" Set-Location -Path $downloadPath -$installerPath = Start-DownloadWithRetry -Url "https://go.microsoft.com/fwlink/?linkid=866658" -Name SQL2019-SSEI-Expr.exe +$installerPath = Start-DownloadWithRetry -Url "https://go.microsoft.com/fwlink/?linkid=866658" -Name "SQL2019-SSEI-Expr.exe" Download-FullSQLPackage -InstallerPath $installerPath Unpack-SQLInstaller -InstallPath "$setupPath.exe" Start-Installer -InstallPath "$setupPath/SETUP.exe" \ No newline at end of file From 3a426e8c3a6d1b486e3fc9aa25cf9675e4af13bf Mon Sep 17 00:00:00 2001 From: "Dariy.Nurgaleev" Date: Fri, 20 Mar 2020 01:56:57 +0700 Subject: [PATCH 25/49] info messages --- images/win/scripts/Installers/Install-SQLExpress.ps1 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/images/win/scripts/Installers/Install-SQLExpress.ps1 b/images/win/scripts/Installers/Install-SQLExpress.ps1 index 68c56470..ebdb2c74 100644 --- a/images/win/scripts/Installers/Install-SQLExpress.ps1 +++ b/images/win/scripts/Installers/Install-SQLExpress.ps1 @@ -9,6 +9,7 @@ function Download-FullSQLPackage { [String]$InstallerPath, [String]$Arguments = ("/MEDIAPATH=${env:Temp}", "/MEDIATYPE=Core","/Action=Download", "/QUIET") ) + Write-Host "Downloading full package to $InstallerPath..." $process = Start-Process -FilePath $InstallerPath -ArgumentList $Arguments -Wait -PassThru $exitCode = $process.ExitCode if ($exitCode -eq 0) @@ -27,6 +28,7 @@ function Unpack-SQLInstaller { [String]$InstallPath, [String]$Arguments = ("/Q", "/IACCEPTSQLSERVERLICENSETERMS") ) + Write-Host "Start unpacking procedure to $InstallPath..." $process = Start-Process -FilePath $InstallPath -ArgumentList $Arguments -Wait -PassThru $exitCode = $process.ExitCode # Exit code -2067529716 is added since SQL Unpack procedure returns it on success. @@ -46,6 +48,7 @@ function Start-Installer { [String]$InstallPath, [String]$Arguments = ("/Q", "/IACCEPTSQLSERVERLICENSETERMS", "/Action=Install", "/INSTANCEID=SQL2019", "/INSTANCENAME=SQL2019", "/SECURITYMODE=SQL", "/SAPWD=P@ssword!!", "/TCPENABLED=1") ) + Write-Host "Installating SQL Express..." $process = Start-Process -FilePath $InstallPath -ArgumentList $Arguments -Wait -PassThru $exitCode = $process.ExitCode if ($exitCode -eq 0) From d6c9eb8583bba3db3cddc89f5cd9482734be1bc9 Mon Sep 17 00:00:00 2001 From: "Dariy.Nurgaleev" Date: Fri, 20 Mar 2020 02:21:37 +0700 Subject: [PATCH 26/49] changed connection to SQL due to some mistakes --- images/win/scripts/Installers/Validate-SQLExpress.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/images/win/scripts/Installers/Validate-SQLExpress.ps1 b/images/win/scripts/Installers/Validate-SQLExpress.ps1 index ddb4ca3f..75ef9185 100644 --- a/images/win/scripts/Installers/Validate-SQLExpress.ps1 +++ b/images/win/scripts/Installers/Validate-SQLExpress.ps1 @@ -22,10 +22,10 @@ function Test-SqlConnection { $ErrorActionPreference = 'Stop' try { $connectionString = 'Server={0};Integrated Security={1};User ID={2};Password={3}' -f $ServerName,$IntegratedSecurity,$UserName,$Password - Write-Host -Object "Trying to connect to SQL Express instance: $ServerName" + Write-Host $connectionString $sqlConnection = New-Object System.Data.SqlClient.SqlConnection $connectionString $sqlConnection.Open() - Write-Host -Object "Connection to database: {0} was successful. Version of SQL Express is: {1}" -f $sqlConnection.Database,$sqlConnection.ServerVersion + Write-Host -Object "Connection to SQL Express was successful." return $sqlConnection.ServerVersion } catch { From 3e0c42d950442d6d7568ff6326e77bbbd522deec Mon Sep 17 00:00:00 2001 From: "Dariy.Nurgaleev" Date: Fri, 20 Mar 2020 02:29:59 +0700 Subject: [PATCH 27/49] remove redundunt write-host --- images/win/scripts/Installers/Validate-SQLExpress.ps1 | 1 - 1 file changed, 1 deletion(-) diff --git a/images/win/scripts/Installers/Validate-SQLExpress.ps1 b/images/win/scripts/Installers/Validate-SQLExpress.ps1 index 75ef9185..1b5a3578 100644 --- a/images/win/scripts/Installers/Validate-SQLExpress.ps1 +++ b/images/win/scripts/Installers/Validate-SQLExpress.ps1 @@ -22,7 +22,6 @@ function Test-SqlConnection { $ErrorActionPreference = 'Stop' try { $connectionString = 'Server={0};Integrated Security={1};User ID={2};Password={3}' -f $ServerName,$IntegratedSecurity,$UserName,$Password - Write-Host $connectionString $sqlConnection = New-Object System.Data.SqlClient.SqlConnection $connectionString $sqlConnection.Open() Write-Host -Object "Connection to SQL Express was successful." From ee850858850a9d475558baf7ab033e1b9f1437fc Mon Sep 17 00:00:00 2001 From: "Dariy.Nurgaleev" Date: Fri, 20 Mar 2020 11:33:59 +0700 Subject: [PATCH 28/49] added download with retry function to psm. --- images/win/scripts/ImageHelpers/ImageHelpers.psm1 | 1 + 1 file changed, 1 insertion(+) diff --git a/images/win/scripts/ImageHelpers/ImageHelpers.psm1 b/images/win/scripts/ImageHelpers/ImageHelpers.psm1 index 743dc7a1..c40b1098 100644 --- a/images/win/scripts/ImageHelpers/ImageHelpers.psm1 +++ b/images/win/scripts/ImageHelpers/ImageHelpers.psm1 @@ -20,6 +20,7 @@ Export-ModuleMember -Function @( 'Add-SoftwareDetailsToMarkdown' 'Stop-SvcWithErrHandling' 'Set-SvcWithErrHandling' + 'Start-DownloadWithRetry' 'Install-VsixExtension' 'Get-VSExtensionVersion' 'Get-WinVersion' From fbf0e5ea07a09d2d4b6420e5e785058808214276 Mon Sep 17 00:00:00 2001 From: "Dariy.Nurgaleev" Date: Fri, 20 Mar 2020 11:38:05 +0700 Subject: [PATCH 29/49] changed installvsix. added downloadwithretry func --- .../scripts/ImageHelpers/InstallHelpers.ps1 | 29 +------------------ 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/images/win/scripts/ImageHelpers/InstallHelpers.ps1 b/images/win/scripts/ImageHelpers/InstallHelpers.ps1 index 910fbe5c..8ba4594e 100644 --- a/images/win/scripts/ImageHelpers/InstallHelpers.ps1 +++ b/images/win/scripts/ImageHelpers/InstallHelpers.ps1 @@ -217,34 +217,7 @@ function Install-VsixExtension if (!$InstallOnly) { - $FilePath = "${env:Temp}\$Name" - - while($retries -gt 0) - { - try - { - Write-Host "Downloading $Name..." - (New-Object System.Net.WebClient).DownloadFile($Url, $FilePath) - break - } - catch - { - Write-Host "There is an error during $Name downloading" - $_ - - $retries-- - - if ($retries -eq 0) - { - Write-Host "File can't be downloaded" - $_ - exit 1 - } - - Write-Host "Waiting 30 seconds before retrying. Retries left: $retries" - Start-Sleep -Seconds 30 - } - } + $FilePath = Start-DownloadWithRetry -Url $Url -Name $Name } $ArgumentList = ('/quiet', "`"$FilePath`"") From 3c6b72b40d600651ad860c0d0622fe481d5cfbab Mon Sep 17 00:00:00 2001 From: "Dariy.Nurgaleev" Date: Fri, 20 Mar 2020 18:48:51 +0700 Subject: [PATCH 30/49] changed setupPath join --- images/win/scripts/Installers/Install-SQLExpress.ps1 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/images/win/scripts/Installers/Install-SQLExpress.ps1 b/images/win/scripts/Installers/Install-SQLExpress.ps1 index ebdb2c74..8b40d921 100644 --- a/images/win/scripts/Installers/Install-SQLExpress.ps1 +++ b/images/win/scripts/Installers/Install-SQLExpress.ps1 @@ -45,11 +45,11 @@ function Unpack-SQLInstaller { function Start-Installer { param( - [String]$InstallPath, + [String]$InstallerPath, [String]$Arguments = ("/Q", "/IACCEPTSQLSERVERLICENSETERMS", "/Action=Install", "/INSTANCEID=SQL2019", "/INSTANCENAME=SQL2019", "/SECURITYMODE=SQL", "/SAPWD=P@ssword!!", "/TCPENABLED=1") ) Write-Host "Installating SQL Express..." - $process = Start-Process -FilePath $InstallPath -ArgumentList $Arguments -Wait -PassThru + $process = Start-Process -FilePath $InstallerPath -ArgumentList $Arguments -Wait -PassThru $exitCode = $process.ExitCode if ($exitCode -eq 0) { @@ -67,5 +67,5 @@ $setupPath = Join-Path $downloadPath "SQLEXPR_x64_ENU" Set-Location -Path $downloadPath $installerPath = Start-DownloadWithRetry -Url "https://go.microsoft.com/fwlink/?linkid=866658" -Name "SQL2019-SSEI-Expr.exe" Download-FullSQLPackage -InstallerPath $installerPath -Unpack-SQLInstaller -InstallPath "$setupPath.exe" -Start-Installer -InstallPath "$setupPath/SETUP.exe" \ No newline at end of file +Unpack-SQLInstaller -InstallPath (Join-Path $setupPath ".exe") +Start-Installer -InstallPath (Join-Path $setupPath "SETUP.exe") \ No newline at end of file From 25fabc3d1bd4fee7a145788cb5dd0047f2562421 Mon Sep 17 00:00:00 2001 From: "Dariy.Nurgaleev" Date: Fri, 20 Mar 2020 19:09:06 +0700 Subject: [PATCH 31/49] fix for installerPath --- images/win/scripts/Installers/Install-SQLExpress.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/images/win/scripts/Installers/Install-SQLExpress.ps1 b/images/win/scripts/Installers/Install-SQLExpress.ps1 index 8b40d921..12b8019a 100644 --- a/images/win/scripts/Installers/Install-SQLExpress.ps1 +++ b/images/win/scripts/Installers/Install-SQLExpress.ps1 @@ -67,5 +67,5 @@ $setupPath = Join-Path $downloadPath "SQLEXPR_x64_ENU" Set-Location -Path $downloadPath $installerPath = Start-DownloadWithRetry -Url "https://go.microsoft.com/fwlink/?linkid=866658" -Name "SQL2019-SSEI-Expr.exe" Download-FullSQLPackage -InstallerPath $installerPath -Unpack-SQLInstaller -InstallPath (Join-Path $setupPath ".exe") -Start-Installer -InstallPath (Join-Path $setupPath "SETUP.exe") \ No newline at end of file +Unpack-SQLInstaller -InstallPath "$setupPath.exe" +Start-Installer -InstallerPath "$setupPath\SETUP.exe" \ No newline at end of file From 66a71260b4105e3ec70b126eb5b92d85fa3785f4 Mon Sep 17 00:00:00 2001 From: "Dariy.Nurgaleev" Date: Sun, 22 Mar 2020 20:17:57 +0700 Subject: [PATCH 32/49] added resultPath to resolve the issue --- images/win/scripts/Installers/Install-SQLExpress.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/images/win/scripts/Installers/Install-SQLExpress.ps1 b/images/win/scripts/Installers/Install-SQLExpress.ps1 index 12b8019a..419e410d 100644 --- a/images/win/scripts/Installers/Install-SQLExpress.ps1 +++ b/images/win/scripts/Installers/Install-SQLExpress.ps1 @@ -68,4 +68,5 @@ Set-Location -Path $downloadPath $installerPath = Start-DownloadWithRetry -Url "https://go.microsoft.com/fwlink/?linkid=866658" -Name "SQL2019-SSEI-Expr.exe" Download-FullSQLPackage -InstallerPath $installerPath Unpack-SQLInstaller -InstallPath "$setupPath.exe" -Start-Installer -InstallerPath "$setupPath\SETUP.exe" \ No newline at end of file +$resultPath = Join-Path $setupPath "SETUP.exe" +Start-Installer -InstallerPath $resultPath \ No newline at end of file From 1dcacb7449e5ff59dfdf94bce9493c2c84e9d13b Mon Sep 17 00:00:00 2001 From: "Dariy.Nurgaleev" Date: Tue, 24 Mar 2020 12:50:18 +0700 Subject: [PATCH 33/49] added comment --- images/win/scripts/Installers/Install-SQLExpress.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/images/win/scripts/Installers/Install-SQLExpress.ps1 b/images/win/scripts/Installers/Install-SQLExpress.ps1 index 419e410d..2c0293d2 100644 --- a/images/win/scripts/Installers/Install-SQLExpress.ps1 +++ b/images/win/scripts/Installers/Install-SQLExpress.ps1 @@ -61,6 +61,7 @@ function Start-Installer { exit $exitCode } } +#Main function $installerUrl = "https://go.microsoft.com/fwlink/?linkid=866658" $downloadPath = "${env:Temp}" $setupPath = Join-Path $downloadPath "SQLEXPR_x64_ENU" From 98077f0a0ad9739198467fbedffa386df6855155 Mon Sep 17 00:00:00 2001 From: "Dariy.Nurgaleev" Date: Tue, 24 Mar 2020 12:54:43 +0700 Subject: [PATCH 34/49] short list --- images/win/Windows2019-Azure.json | 765 ------------------------------ 1 file changed, 765 deletions(-) diff --git a/images/win/Windows2019-Azure.json b/images/win/Windows2019-Azure.json index 399758f5..b3b67ca8 100644 --- a/images/win/Windows2019-Azure.json +++ b/images/win/Windows2019-Azure.json @@ -103,346 +103,6 @@ "{{ template_dir }}/scripts/Installers/Windows2019/Initialize-VM.ps1" ] }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Update-DotnetTLS.ps1" - ] - }, - { - "type": "windows-restart", - "restart_timeout": "10m" - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Install-ContainersFeature.ps1" - ] - }, - { - "type": "windows-restart", - "restart_timeout": "10m" - }, - { - "type": "powershell", - "inline": [ - "setx ImageVersion {{user `image_version` }} /m", - "setx ImageOS {{user `image_os` }} /m" - ] - }, - { - "type": "powershell", - "environment_vars": [ - "IMAGE_VERSION={{user `image_version`}}", - "IMAGEDATA_FILE={{user `imagedata_file`}}" - ], - "scripts":[ - "{{ template_dir }}/scripts/Installers/Update-ImageData.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Install-Docker.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Install-PowershellCore.ps1" - ] - }, - { - "type": "windows-restart", - "restart_timeout": "10m" - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-Docker.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-PowershellCore.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Windows2019/Update-DockerImages.ps1" - ] - }, - { - "type": "powershell", - "valid_exit_codes": [ - 0, - 3010 - ], - "scripts":[ - "{{ template_dir }}/scripts/Installers/Windows2019/Install-VS2019.ps1" - ], - "elevated_user": "{{user `install_user`}}", - "elevated_password": "{{user `install_password`}}" - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Install-Wix.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Windows2019/Install-SSDTExtensions.ps1" - ] - }, - { - "type": "powershell", - "valid_exit_codes": [ - 0, - 3010 - ], - "scripts":[ - "{{ template_dir }}/scripts/Installers/Install-NET48.ps1" - ] - }, - { - "type": "powershell", - "scripts": [ - "{{ template_dir }}/scripts/Installers/Install-WDK.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Install-ServiceFabricSDK.ps1" - ] - }, - { - "type": "windows-restart", - "restart_timeout": "10m" - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-Wix.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Windows2019/Validate-SSDTExtensions.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-NET48.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-WDK.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-ServiceFabricSDK.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Install-AzureCli.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Install-AzureDevOpsCli.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Install-NodeLts.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Install-7zip.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Install-Packer.ps1" - ] - }, - { - "type": "file", - "source": "{{template_dir}}/toolcache-2019.json", - "destination": "{{user `root_folder`}}/toolcache.json" - }, - { - "type": "powershell", - "environment_vars":[ - "GITHUB_FEED_TOKEN={{ user `github_feed_token` }}", - "ROOT_FOLDER={{user `root_folder`}}" - ], - "scripts":[ - "{{ template_dir }}/scripts/Installers/Download-ToolCache.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Install-OpenSSL.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Install-Perl.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Install-Git.ps1" - ] - }, - { - "type": "powershell", - "environment_vars": [ - "GO_VERSIONS={{user `go_versions`}}", - "GO_DEFAULT={{user `go_default`}}" - ], - "scripts":[ - "{{ template_dir }}/scripts/Installers/Install-Go.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Install-PHP.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Install-Rust.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Install-Julia.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Install-Sbt.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Install-Svn.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Install-Chrome.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Install-Edge.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Install-Firefox.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Install-Selenium.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Install-IEWebDriver.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Enable-DeveloperMode.ps1" - ], - "elevated_user": "{{user `install_user`}}", - "elevated_password": "{{user `install_password`}}" - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Install-VSWhere.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Install-WinAppDriver.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-WinAppDriver.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Install-JavaTools.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Install-Cmake.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Install-DACFx.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Update-AndroidSDK.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Install-MysqlCli.ps1" - ] - }, { "type": "powershell", "elevated_user": "SYSTEM", @@ -451,441 +111,16 @@ "{{ template_dir }}/scripts/Installers/Install-SQLExpress.ps1" ] }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Install-SQLPowerShellTools.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Install-DotnetSDK.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Install-WindowsUpdates.ps1" - ] - }, - { - "type": "windows-shell", - "inline": ["wmic product where \"name like '%%microsoft azure powershell%%'\" call uninstall /nointeractive"] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Install-AzureModules.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Install-MinGW.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Install-TypeScript.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Install-Miniconda.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Install-AzureCosmosDbEmulator.ps1" - ] - }, - { - "type": "powershell", - "environment_vars": [ - "ROOT_FOLDER={{user `root_folder`}}", - "BOOST_DEFAULT={{user `boost_default`}}" - ], - "scripts":[ - "{{ template_dir }}/scripts/Installers/Install-Boost.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Install-Mercurial.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Install-Jq.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Install-Zstd.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Install-InnoSetup.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Install-GitVersion.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Install-NSIS.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Install-CloudFoundryCli.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Install-Vcpkg.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Install-KubernetesCli.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Install-Kind.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Install-Bazel.ps1" - ] - }, - { - "type": "windows-restart", - "restart_timeout": "10m" - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-AzureModules.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-DotnetTLS.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-AzureCli.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-AzureDevOpsCli.ps1" - ] - }, - { - "type": "powershell", - "environment_vars":[ - "ROOT_FOLDER={{user `root_folder`}}" - ], - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-ToolCache.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-OpenSSL.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-Perl.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-Git.ps1" - ] - }, - { - "type": "powershell", - "environment_vars": [ - "GO_VERSIONS={{user `go_versions`}}", - "GO_DEFAULT={{user `go_default`}}" - ], - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-Go.ps1" - ] - }, - { - "type": "powershell", - "environment_vars": [ - "ROOT_FOLDER={{user `root_folder`}}", - "BOOST_DEFAULT={{user `boost_default`}}" - ], - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-Boost.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-PHP.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-Rust.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-Julia.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-Svn.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-Sbt.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-Chrome.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-Edge.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-Firefox.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-SeleniumWebDrivers.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-NodeLts.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-JavaTools.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-Cmake.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-DACFx.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-DotnetSDK.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-MysqlCli.ps1" - ] - }, { "type": "powershell", "scripts":[ "{{ template_dir }}/scripts/Installers/Validate-SQLExpress.ps1" ] }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-SQLPowerShellTools.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-MinGW.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-TypeScript.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-Miniconda.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-AzureCosmosDbEmulator.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-7zip.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-Packer.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-Mercurial.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-Jq.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-Zstd.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-InnoSetup.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-GitVersion.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-NSIS.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-CloudFoundryCli.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-Vcpkg.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-VSWhere.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-KubernetesCli.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-Kind.ps1" - ] - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-Bazel.ps1" - ] - }, - { - "type": "file", - "source": "C:\\InstalledSoftware.md", - "destination": "{{ template_dir }}/Windows2019-Readme.md", - "direction": "download" - }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Finalize-VM.ps1" - ] - }, { "type": "windows-restart", "restart_timeout": "10m" }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Windows2019/Run-Antivirus.ps1" - ] - }, { "type": "powershell", "inline": [ From e387112a3a12f9e0c9a88919f86ce8e8cf0e9969 Mon Sep 17 00:00:00 2001 From: "Dariy.Nurgaleev" Date: Tue, 24 Mar 2020 13:53:44 +0700 Subject: [PATCH 35/49] added variable for current position --- images/win/scripts/Installers/Install-SQLExpress.ps1 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/images/win/scripts/Installers/Install-SQLExpress.ps1 b/images/win/scripts/Installers/Install-SQLExpress.ps1 index 2c0293d2..2dca217e 100644 --- a/images/win/scripts/Installers/Install-SQLExpress.ps1 +++ b/images/win/scripts/Installers/Install-SQLExpress.ps1 @@ -70,4 +70,6 @@ $installerPath = Start-DownloadWithRetry -Url "https://go.microsoft.com/fwlink/? Download-FullSQLPackage -InstallerPath $installerPath Unpack-SQLInstaller -InstallPath "$setupPath.exe" $resultPath = Join-Path $setupPath "SETUP.exe" +Write-Host $resultPath +ls Start-Installer -InstallerPath $resultPath \ No newline at end of file From aac8f5b66b3d1aa4d1d39a7d1c4f4c940c1b5205 Mon Sep 17 00:00:00 2001 From: "Dariy.Nurgaleev" Date: Tue, 24 Mar 2020 14:54:47 +0700 Subject: [PATCH 36/49] added file content --- images/win/scripts/Installers/Install-SQLExpress.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/images/win/scripts/Installers/Install-SQLExpress.ps1 b/images/win/scripts/Installers/Install-SQLExpress.ps1 index 2dca217e..e566fed3 100644 --- a/images/win/scripts/Installers/Install-SQLExpress.ps1 +++ b/images/win/scripts/Installers/Install-SQLExpress.ps1 @@ -72,4 +72,5 @@ Unpack-SQLInstaller -InstallPath "$setupPath.exe" $resultPath = Join-Path $setupPath "SETUP.exe" Write-Host $resultPath ls +type SQLEXPR_x64_ENU_decompression_log.txt Start-Installer -InstallerPath $resultPath \ No newline at end of file From 409a20175e00985bf8004ca8ab402083f5baba62 Mon Sep 17 00:00:00 2001 From: "Dariy.Nurgaleev" Date: Tue, 24 Mar 2020 15:11:15 +0700 Subject: [PATCH 37/49] Need to move out system directory --- images/win/scripts/Installers/Install-SQLExpress.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/images/win/scripts/Installers/Install-SQLExpress.ps1 b/images/win/scripts/Installers/Install-SQLExpress.ps1 index e566fed3..d6bbfaa3 100644 --- a/images/win/scripts/Installers/Install-SQLExpress.ps1 +++ b/images/win/scripts/Installers/Install-SQLExpress.ps1 @@ -7,7 +7,7 @@ Import-Module -Name ImageHelpers -Force; function Download-FullSQLPackage { param( [String]$InstallerPath, - [String]$Arguments = ("/MEDIAPATH=${env:Temp}", "/MEDIATYPE=Core","/Action=Download", "/QUIET") + [String]$Arguments = ("/MEDIAPATH=C:\SQLInstall", "/MEDIATYPE=Core","/Action=Download", "/QUIET") ) Write-Host "Downloading full package to $InstallerPath..." $process = Start-Process -FilePath $InstallerPath -ArgumentList $Arguments -Wait -PassThru @@ -63,7 +63,7 @@ function Start-Installer { } #Main function $installerUrl = "https://go.microsoft.com/fwlink/?linkid=866658" -$downloadPath = "${env:Temp}" +$downloadPath = "C:\SQLInstall" $setupPath = Join-Path $downloadPath "SQLEXPR_x64_ENU" Set-Location -Path $downloadPath $installerPath = Start-DownloadWithRetry -Url "https://go.microsoft.com/fwlink/?linkid=866658" -Name "SQL2019-SSEI-Expr.exe" From bbf8c7f71c585593dffaa3b44766200eb744e275 Mon Sep 17 00:00:00 2001 From: "Dariy.Nurgaleev" Date: Tue, 24 Mar 2020 15:37:56 +0700 Subject: [PATCH 38/49] change pathes to avoid installation problems --- images/win/scripts/Installers/Install-SQLExpress.ps1 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/images/win/scripts/Installers/Install-SQLExpress.ps1 b/images/win/scripts/Installers/Install-SQLExpress.ps1 index d6bbfaa3..d93f8238 100644 --- a/images/win/scripts/Installers/Install-SQLExpress.ps1 +++ b/images/win/scripts/Installers/Install-SQLExpress.ps1 @@ -7,7 +7,7 @@ Import-Module -Name ImageHelpers -Force; function Download-FullSQLPackage { param( [String]$InstallerPath, - [String]$Arguments = ("/MEDIAPATH=C:\SQLInstall", "/MEDIATYPE=Core","/Action=Download", "/QUIET") + [String]$Arguments = ("/MEDIAPATH=$InstallerPath", "/MEDIATYPE=Core","/Action=Download", "/QUIET") ) Write-Host "Downloading full package to $InstallerPath..." $process = Start-Process -FilePath $InstallerPath -ArgumentList $Arguments -Wait -PassThru @@ -65,8 +65,9 @@ function Start-Installer { $installerUrl = "https://go.microsoft.com/fwlink/?linkid=866658" $downloadPath = "C:\SQLInstall" $setupPath = Join-Path $downloadPath "SQLEXPR_x64_ENU" +md $downloadPath Set-Location -Path $downloadPath -$installerPath = Start-DownloadWithRetry -Url "https://go.microsoft.com/fwlink/?linkid=866658" -Name "SQL2019-SSEI-Expr.exe" +$installerPath = Start-DownloadWithRetry -Url "https://go.microsoft.com/fwlink/?linkid=866658" -DownloadPath $downloadPath -Name "SQL2019-SSEI-Expr.exe" Download-FullSQLPackage -InstallerPath $installerPath Unpack-SQLInstaller -InstallPath "$setupPath.exe" $resultPath = Join-Path $setupPath "SETUP.exe" From 770a4152fda1f82e62f50aa07ee6866b7ae40329 Mon Sep 17 00:00:00 2001 From: "Dariy.Nurgaleev" Date: Tue, 24 Mar 2020 16:12:52 +0700 Subject: [PATCH 39/49] added new variable to FullSQLPackage function --- images/win/scripts/Installers/Install-SQLExpress.ps1 | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/images/win/scripts/Installers/Install-SQLExpress.ps1 b/images/win/scripts/Installers/Install-SQLExpress.ps1 index d93f8238..8e64c621 100644 --- a/images/win/scripts/Installers/Install-SQLExpress.ps1 +++ b/images/win/scripts/Installers/Install-SQLExpress.ps1 @@ -7,14 +7,15 @@ Import-Module -Name ImageHelpers -Force; function Download-FullSQLPackage { param( [String]$InstallerPath, - [String]$Arguments = ("/MEDIAPATH=$InstallerPath", "/MEDIATYPE=Core","/Action=Download", "/QUIET") + [String]$DownloadPath, + [String]$Arguments = ("/MEDIAPATH=$DownloadPath", "/MEDIATYPE=Core","/Action=Download", "/QUIET") ) - Write-Host "Downloading full package to $InstallerPath..." + Write-Host "Downloading full package to $DownloadPath..." $process = Start-Process -FilePath $InstallerPath -ArgumentList $Arguments -Wait -PassThru $exitCode = $process.ExitCode if ($exitCode -eq 0) { - Write-Host -Object "Full SQL Express package has been successfully downloaded to $InstallerPath : ExitCode: $exitCode" + Write-Host -Object "Full SQL Express package has been successfully downloaded to $DownloadPath : ExitCode: $exitCode" } else { @@ -68,7 +69,7 @@ $setupPath = Join-Path $downloadPath "SQLEXPR_x64_ENU" md $downloadPath Set-Location -Path $downloadPath $installerPath = Start-DownloadWithRetry -Url "https://go.microsoft.com/fwlink/?linkid=866658" -DownloadPath $downloadPath -Name "SQL2019-SSEI-Expr.exe" -Download-FullSQLPackage -InstallerPath $installerPath +Download-FullSQLPackage -InstallerPath $installerPath -DownloadPath $downloadPath Unpack-SQLInstaller -InstallPath "$setupPath.exe" $resultPath = Join-Path $setupPath "SETUP.exe" Write-Host $resultPath From 827d2cacd4dfe1614c9a2fc6dad2b91492b5b6f5 Mon Sep 17 00:00:00 2001 From: "Dariy.Nurgaleev" Date: Tue, 24 Mar 2020 16:28:43 +0700 Subject: [PATCH 40/49] cleanup installation folder. --- images/win/scripts/Installers/Install-SQLExpress.ps1 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/images/win/scripts/Installers/Install-SQLExpress.ps1 b/images/win/scripts/Installers/Install-SQLExpress.ps1 index 8e64c621..7e34a9bf 100644 --- a/images/win/scripts/Installers/Install-SQLExpress.ps1 +++ b/images/win/scripts/Installers/Install-SQLExpress.ps1 @@ -73,6 +73,5 @@ Download-FullSQLPackage -InstallerPath $installerPath -DownloadPath $downloadPat Unpack-SQLInstaller -InstallPath "$setupPath.exe" $resultPath = Join-Path $setupPath "SETUP.exe" Write-Host $resultPath -ls -type SQLEXPR_x64_ENU_decompression_log.txt -Start-Installer -InstallerPath $resultPath \ No newline at end of file +Start-Installer -InstallerPath $resultPath +Remove-Item $downloadPath -Recurse \ No newline at end of file From 739bbe26b5fe02c59b7874ba828a5d158fef9347 Mon Sep 17 00:00:00 2001 From: "Dariy.Nurgaleev" Date: Tue, 24 Mar 2020 17:23:59 +0700 Subject: [PATCH 41/49] add comments for all steps --- images/win/scripts/Installers/Install-SQLExpress.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/images/win/scripts/Installers/Install-SQLExpress.ps1 b/images/win/scripts/Installers/Install-SQLExpress.ps1 index 7e34a9bf..27d19147 100644 --- a/images/win/scripts/Installers/Install-SQLExpress.ps1 +++ b/images/win/scripts/Installers/Install-SQLExpress.ps1 @@ -66,12 +66,13 @@ function Start-Installer { $installerUrl = "https://go.microsoft.com/fwlink/?linkid=866658" $downloadPath = "C:\SQLInstall" $setupPath = Join-Path $downloadPath "SQLEXPR_x64_ENU" +#Create directory for temporary files md $downloadPath Set-Location -Path $downloadPath $installerPath = Start-DownloadWithRetry -Url "https://go.microsoft.com/fwlink/?linkid=866658" -DownloadPath $downloadPath -Name "SQL2019-SSEI-Expr.exe" Download-FullSQLPackage -InstallerPath $installerPath -DownloadPath $downloadPath Unpack-SQLInstaller -InstallPath "$setupPath.exe" $resultPath = Join-Path $setupPath "SETUP.exe" -Write-Host $resultPath Start-Installer -InstallerPath $resultPath +#Cleanup folder with installation packages. Remove-Item $downloadPath -Recurse \ No newline at end of file From d3ab1f0bb0afb5ffcc95692fab9387de4b0c7566 Mon Sep 17 00:00:00 2001 From: Dariy Nurgaleev <50947177+Darleev@users.noreply.github.com> Date: Tue, 24 Mar 2020 17:28:01 +0700 Subject: [PATCH 42/49] changed installation packages and cleanup --- .../scripts/Installers/Install-SQLExpress.ps1 | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/images/win/scripts/Installers/Install-SQLExpress.ps1 b/images/win/scripts/Installers/Install-SQLExpress.ps1 index 419e410d..99da3ccd 100644 --- a/images/win/scripts/Installers/Install-SQLExpress.ps1 +++ b/images/win/scripts/Installers/Install-SQLExpress.ps1 @@ -7,14 +7,15 @@ Import-Module -Name ImageHelpers -Force; function Download-FullSQLPackage { param( [String]$InstallerPath, - [String]$Arguments = ("/MEDIAPATH=${env:Temp}", "/MEDIATYPE=Core","/Action=Download", "/QUIET") + [String]$DownloadPath, + [String]$Arguments = ("/MEDIAPATH=$DownloadPath", "/MEDIATYPE=Core","/Action=Download", "/QUIET") ) - Write-Host "Downloading full package to $InstallerPath..." + Write-Host "Downloading full package to $DownloadPath..." $process = Start-Process -FilePath $InstallerPath -ArgumentList $Arguments -Wait -PassThru $exitCode = $process.ExitCode if ($exitCode -eq 0) { - Write-Host -Object "Full SQL Express package has been successfully downloaded to $InstallerPath : ExitCode: $exitCode" + Write-Host -Object "Full SQL Express package has been successfully downloaded to $DownloadPath : ExitCode: $exitCode" } else { @@ -61,12 +62,17 @@ function Start-Installer { exit $exitCode } } +#Main function $installerUrl = "https://go.microsoft.com/fwlink/?linkid=866658" -$downloadPath = "${env:Temp}" +$downloadPath = "C:\SQLInstall" $setupPath = Join-Path $downloadPath "SQLEXPR_x64_ENU" +#Create directory for temporary files +md $downloadPath Set-Location -Path $downloadPath -$installerPath = Start-DownloadWithRetry -Url "https://go.microsoft.com/fwlink/?linkid=866658" -Name "SQL2019-SSEI-Expr.exe" -Download-FullSQLPackage -InstallerPath $installerPath +$installerPath = Start-DownloadWithRetry -Url "https://go.microsoft.com/fwlink/?linkid=866658" -DownloadPath $downloadPath -Name "SQL2019-SSEI-Expr.exe" +Download-FullSQLPackage -InstallerPath $installerPath -DownloadPath $downloadPath Unpack-SQLInstaller -InstallPath "$setupPath.exe" $resultPath = Join-Path $setupPath "SETUP.exe" -Start-Installer -InstallerPath $resultPath \ No newline at end of file +Start-Installer -InstallerPath $resultPath +#Cleanup folder with installation packages. +Remove-Item $downloadPath -Recurse From dd931593e82f16c037c9a87a12427f97b1b3e482 Mon Sep 17 00:00:00 2001 From: "Dariy.Nurgaleev" Date: Tue, 24 Mar 2020 17:35:11 +0700 Subject: [PATCH 43/49] small changes for scripts. --- images/win/scripts/ImageHelpers/InstallHelpers.ps1 | 2 +- images/win/scripts/Installers/Install-SQLExpress.ps1 | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/images/win/scripts/ImageHelpers/InstallHelpers.ps1 b/images/win/scripts/ImageHelpers/InstallHelpers.ps1 index 8ba4594e..03c4b98f 100644 --- a/images/win/scripts/ImageHelpers/InstallHelpers.ps1 +++ b/images/win/scripts/ImageHelpers/InstallHelpers.ps1 @@ -166,9 +166,9 @@ function Start-DownloadWithRetry param ( [Parameter(Mandatory)] [string] $Url, - [string] $DownloadPath = "${env:Temp}", [Parameter(Mandatory)] [string] $Name, + [string] $DownloadPath = "${env:Temp}", [int] $retries = 20 ) $FilePath = Join-Path $DownloadPath $Name diff --git a/images/win/scripts/Installers/Install-SQLExpress.ps1 b/images/win/scripts/Installers/Install-SQLExpress.ps1 index 27d19147..a56f09cc 100644 --- a/images/win/scripts/Installers/Install-SQLExpress.ps1 +++ b/images/win/scripts/Installers/Install-SQLExpress.ps1 @@ -6,6 +6,7 @@ Import-Module -Name ImageHelpers -Force; function Download-FullSQLPackage { param( + [Parameter(Mandatory)] [String]$InstallerPath, [String]$DownloadPath, [String]$Arguments = ("/MEDIAPATH=$DownloadPath", "/MEDIATYPE=Core","/Action=Download", "/QUIET") @@ -26,6 +27,7 @@ function Download-FullSQLPackage { function Unpack-SQLInstaller { param( + [Parameter(Mandatory)] [String]$InstallPath, [String]$Arguments = ("/Q", "/IACCEPTSQLSERVERLICENSETERMS") ) @@ -46,6 +48,7 @@ function Unpack-SQLInstaller { function Start-Installer { param( + [Parameter(Mandatory)] [String]$InstallerPath, [String]$Arguments = ("/Q", "/IACCEPTSQLSERVERLICENSETERMS", "/Action=Install", "/INSTANCEID=SQL2019", "/INSTANCENAME=SQL2019", "/SECURITYMODE=SQL", "/SAPWD=P@ssword!!", "/TCPENABLED=1") ) @@ -69,7 +72,7 @@ $setupPath = Join-Path $downloadPath "SQLEXPR_x64_ENU" #Create directory for temporary files md $downloadPath Set-Location -Path $downloadPath -$installerPath = Start-DownloadWithRetry -Url "https://go.microsoft.com/fwlink/?linkid=866658" -DownloadPath $downloadPath -Name "SQL2019-SSEI-Expr.exe" +$installerPath = Start-DownloadWithRetry -Url $installerUrl -DownloadPath $downloadPath -Name "SQL2019-SSEI-Expr.exe" Download-FullSQLPackage -InstallerPath $installerPath -DownloadPath $downloadPath Unpack-SQLInstaller -InstallPath "$setupPath.exe" $resultPath = Join-Path $setupPath "SETUP.exe" From 2c98daaee3490f431a750b820209017ad066ccec Mon Sep 17 00:00:00 2001 From: "Dariy.Nurgaleev" Date: Tue, 24 Mar 2020 17:44:29 +0700 Subject: [PATCH 44/49] Windows2019 file was corrupted --- images/win/Windows2019-Azure.json | 772 +++++++++++++++++++++++++++++- 1 file changed, 768 insertions(+), 4 deletions(-) diff --git a/images/win/Windows2019-Azure.json b/images/win/Windows2019-Azure.json index b3b67ca8..e723d97f 100644 --- a/images/win/Windows2019-Azure.json +++ b/images/win/Windows2019-Azure.json @@ -30,8 +30,7 @@ "image_os": "win19", "github_feed_token": "{{env `GITHUB_FEED_TOKEN`}}", "go_versions": "1.9, 1.10, 1.11, 1.12, 1.13, 1.14", - "go_default": "1.14", - "boost_default": "1.72.0" + "go_default": "1.14" }, "sensitive-variables": ["install_password", "ssh_password", "client_secret", "github_feed_token"], "builders": [ @@ -103,6 +102,340 @@ "{{ template_dir }}/scripts/Installers/Windows2019/Initialize-VM.ps1" ] }, + { + "type": "windows-restart", + "restart_timeout": "10m" + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-ContainersFeature.ps1" + ] + }, + { + "type": "windows-restart", + "restart_timeout": "10m" + }, + { + "type": "powershell", + "inline": [ + "setx ImageVersion {{user `image_version` }} /m", + "setx ImageOS {{user `image_os` }} /m" + ] + }, + { + "type": "powershell", + "environment_vars": [ + "IMAGE_VERSION={{user `image_version`}}", + "IMAGEDATA_FILE={{user `imagedata_file`}}" + ], + "scripts":[ + "{{ template_dir }}/scripts/Installers/Update-ImageData.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-Docker.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-PowershellCore.ps1" + ] + }, + { + "type": "windows-restart", + "restart_timeout": "10m" + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-Docker.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-PowershellCore.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Windows2019/Update-DockerImages.ps1" + ] + }, + { + "type": "powershell", + "valid_exit_codes": [ + 0, + 3010 + ], + "scripts":[ + "{{ template_dir }}/scripts/Installers/Windows2019/Install-VS2019.ps1" + ], + "elevated_user": "{{user `install_user`}}", + "elevated_password": "{{user `install_password`}}" + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Windows2019/Install-Wix.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Windows2019/Install-AnalysisExtenstion.ps1" + ] + }, + { + "type": "powershell", + "valid_exit_codes": [ + 0, + 3010 + ], + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-NET48.ps1" + ] + }, + { + "type": "powershell", + "scripts": [ + "{{ template_dir }}/scripts/Installers/Windows2019/Install-WDK.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-ServiceFabricSDK.ps1" + ] + }, + { + "type": "windows-restart", + "restart_timeout": "10m" + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Windows2019/Validate-Wix.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Windows2019/Validate-AnalysisExtenstion.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-NET48.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Windows2019/Validate-WDK.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-ServiceFabricSDK.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Update-DotnetTLS.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-AzureCli.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-AzureDevOpsCli.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-NodeLts.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-7zip.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-Packer.ps1" + ] + }, + { + "type": "file", + "source": "{{template_dir}}/toolcache-2019.json", + "destination": "{{user `root_folder`}}/toolcache.json" + }, + { + "type": "powershell", + "environment_vars":[ + "GITHUB_FEED_TOKEN={{ user `github_feed_token` }}", + "ROOT_FOLDER={{user `root_folder`}}" + ], + "scripts":[ + "{{ template_dir }}/scripts/Installers/Download-ToolCache.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-Perl.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-Git.ps1" + ] + }, + { + "type": "powershell", + "environment_vars": [ + "GO_VERSIONS={{user `go_versions`}}", + "GO_DEFAULT={{user `go_default`}}" + ], + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-Go.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-PHP.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-Rust.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-Julia.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-Sbt.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-Svn.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-Chrome.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-Edge.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-Firefox.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-Selenium.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-IEWebDriver.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Enable-DeveloperMode.ps1" + ], + "elevated_user": "{{user `install_user`}}", + "elevated_password": "{{user `install_password`}}" + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-VSWhere.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-WinAppDriver.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-WinAppDriver.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-JavaTools.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-Cmake.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-DACFx.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Update-AndroidSDK.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-MysqlCli.ps1" + ] + }, { "type": "powershell", "elevated_user": "SYSTEM", @@ -114,13 +447,444 @@ { "type": "powershell", "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-SQLExpress.ps1" + "{{ template_dir }}/scripts/Installers/Install-SQLPowerShellTools.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-DotnetSDK.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-WindowsUpdates.ps1" + ] + }, + { + "type": "windows-shell", + "inline": ["wmic product where \"name like '%%microsoft azure powershell%%'\" call uninstall /nointeractive"] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-AzureModules.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-MinGW.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-TypeScript.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-Miniconda.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-AzureCosmosDbEmulator.ps1" + ] + }, + { + "type": "powershell", + "environment_vars": [ + "BOOST_VERSIONS=1.69.0,1.72.0", + "BOOST_DEFAULT=1.72.0" + ], + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-Boost.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-Mercurial.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-Jq.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-Zstd.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-InnoSetup.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-GitVersion.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-OpenSSL.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-NSIS.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-CloudFoundryCli.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-Vcpkg.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-KubernetesCli.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-Kind.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-Bazel.ps1" ] }, { "type": "windows-restart", "restart_timeout": "10m" }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-AzureModules.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-DotnetTLS.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-AzureCli.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-AzureDevOpsCli.ps1" + ] + }, + { + "type": "powershell", + "environment_vars":[ + "ROOT_FOLDER={{user `root_folder`}}" + ], + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-ToolCache.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-Perl.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-Git.ps1" + ] + }, + { + "type": "powershell", + "environment_vars": [ + "GO_VERSIONS={{user `go_versions`}}", + "GO_DEFAULT={{user `go_default`}}" + ], + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-Go.ps1" + ] + }, + { + "type": "powershell", + "environment_vars": [ + "BOOST_VERSIONS=1.69.0,1.72.0", + "BOOST_DEFAULT=1.72.0" + ], + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-Boost.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-PHP.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-Rust.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-Julia.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-Svn.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-Sbt.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-Chrome.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-Edge.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-Firefox.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-SeleniumWebDrivers.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-NodeLts.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-JavaTools.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-Cmake.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-DACFx.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-DotnetSDK.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-MysqlCli.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-SQLExpress.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-SQLPowerShellTools.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-MinGW.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-TypeScript.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-Miniconda.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-AzureCosmosDbEmulator.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-7zip.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-Packer.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-Mercurial.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-Jq.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-Zstd.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-InnoSetup.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-GitVersion.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-OpenSSL.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-NSIS.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-CloudFoundryCli.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-Vcpkg.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-VSWhere.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-KubernetesCli.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-Kind.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-Bazel.ps1" + ] + }, + { + "type": "file", + "source": "C:\\InstalledSoftware.md", + "destination": "{{ template_dir }}/Windows2019-Readme.md", + "direction": "download" + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Finalize-VM.ps1" + ] + }, + { + "type": "windows-restart", + "restart_timeout": "10m" + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Windows2019/Run-Antivirus.ps1" + ] + }, { "type": "powershell", "inline": [ @@ -130,4 +894,4 @@ ] } ] -} +} \ No newline at end of file From 20f097261725533d329421e2100a40c62f74549e Mon Sep 17 00:00:00 2001 From: "Dariy.Nurgaleev" Date: Tue, 24 Mar 2020 17:50:46 +0700 Subject: [PATCH 45/49] fixed Install-Wix change. --- images/win/Windows2019-Azure.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/images/win/Windows2019-Azure.json b/images/win/Windows2019-Azure.json index e723d97f..2b081be7 100644 --- a/images/win/Windows2019-Azure.json +++ b/images/win/Windows2019-Azure.json @@ -182,7 +182,7 @@ { "type": "powershell", "scripts":[ - "{{ template_dir }}/scripts/Installers/Windows2019/Install-Wix.ps1" + "{{ template_dir }}/scripts/Installers/Install-Wix.ps1" ] }, { From d9c166b7930bb9593d99e6c205bcacd7aaa2e9c9 Mon Sep 17 00:00:00 2001 From: "Dariy.Nurgaleev" Date: Tue, 24 Mar 2020 17:57:29 +0700 Subject: [PATCH 46/49] applied proper changes for Windows2019 --- images/win/Windows2019-Azure.json | 57 ++++++++++++++++--------------- 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/images/win/Windows2019-Azure.json b/images/win/Windows2019-Azure.json index 2b081be7..e965b9a0 100644 --- a/images/win/Windows2019-Azure.json +++ b/images/win/Windows2019-Azure.json @@ -30,7 +30,8 @@ "image_os": "win19", "github_feed_token": "{{env `GITHUB_FEED_TOKEN`}}", "go_versions": "1.9, 1.10, 1.11, 1.12, 1.13, 1.14", - "go_default": "1.14" + "go_default": "1.14", + "boost_default": "1.72.0" }, "sensitive-variables": ["install_password", "ssh_password", "client_secret", "github_feed_token"], "builders": [ @@ -102,6 +103,12 @@ "{{ template_dir }}/scripts/Installers/Windows2019/Initialize-VM.ps1" ] }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Update-DotnetTLS.ps1" + ] + }, { "type": "windows-restart", "restart_timeout": "10m" @@ -188,7 +195,7 @@ { "type": "powershell", "scripts":[ - "{{ template_dir }}/scripts/Installers/Windows2019/Install-AnalysisExtenstion.ps1" + "{{ template_dir }}/scripts/Installers/Windows2019/Install-SSDTExtensions.ps1" ] }, { @@ -204,7 +211,7 @@ { "type": "powershell", "scripts": [ - "{{ template_dir }}/scripts/Installers/Windows2019/Install-WDK.ps1" + "{{ template_dir }}/scripts/Installers/Install-WDK.ps1" ] }, { @@ -220,13 +227,13 @@ { "type": "powershell", "scripts":[ - "{{ template_dir }}/scripts/Installers/Windows2019/Validate-Wix.ps1" + "{{ template_dir }}/scripts/Installers/Validate-Wix.ps1" ] }, { "type": "powershell", "scripts":[ - "{{ template_dir }}/scripts/Installers/Windows2019/Validate-AnalysisExtenstion.ps1" + "{{ template_dir }}/scripts/Installers/Windows2019/Validate-SSDTExtensions.ps1" ] }, { @@ -238,7 +245,7 @@ { "type": "powershell", "scripts":[ - "{{ template_dir }}/scripts/Installers/Windows2019/Validate-WDK.ps1" + "{{ template_dir }}/scripts/Installers/Validate-WDK.ps1" ] }, { @@ -247,12 +254,6 @@ "{{ template_dir }}/scripts/Installers/Validate-ServiceFabricSDK.ps1" ] }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Update-DotnetTLS.ps1" - ] - }, { "type": "powershell", "scripts":[ @@ -298,6 +299,12 @@ "{{ template_dir }}/scripts/Installers/Download-ToolCache.ps1" ] }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-OpenSSL.ps1" + ] + }, { "type": "powershell", "scripts":[ @@ -499,8 +506,8 @@ { "type": "powershell", "environment_vars": [ - "BOOST_VERSIONS=1.69.0,1.72.0", - "BOOST_DEFAULT=1.72.0" + "ROOT_FOLDER={{user `root_folder`}}", + "BOOST_DEFAULT={{user `boost_default`}}" ], "scripts":[ "{{ template_dir }}/scripts/Installers/Install-Boost.ps1" @@ -536,12 +543,6 @@ "{{ template_dir }}/scripts/Installers/Install-GitVersion.ps1" ] }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Install-OpenSSL.ps1" - ] - }, { "type": "powershell", "scripts":[ @@ -615,6 +616,12 @@ "{{ template_dir }}/scripts/Installers/Validate-ToolCache.ps1" ] }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-OpenSSL.ps1" + ] + }, { "type": "powershell", "scripts":[ @@ -640,8 +647,8 @@ { "type": "powershell", "environment_vars": [ - "BOOST_VERSIONS=1.69.0,1.72.0", - "BOOST_DEFAULT=1.72.0" + "ROOT_FOLDER={{user `root_folder`}}", + "BOOST_DEFAULT={{user `boost_default`}}" ], "scripts":[ "{{ template_dir }}/scripts/Installers/Validate-Boost.ps1" @@ -815,12 +822,6 @@ "{{ template_dir }}/scripts/Installers/Validate-GitVersion.ps1" ] }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-OpenSSL.ps1" - ] - }, { "type": "powershell", "scripts":[ From 0bf06144d7e5d4f62561fabac37f13ccbf4db0a2 Mon Sep 17 00:00:00 2001 From: "Dariy.Nurgaleev" Date: Wed, 25 Mar 2020 03:22:40 +0700 Subject: [PATCH 47/49] added mkdir instetad of md --- images/win/scripts/Installers/Install-SQLExpress.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/images/win/scripts/Installers/Install-SQLExpress.ps1 b/images/win/scripts/Installers/Install-SQLExpress.ps1 index f2a732af..79956502 100644 --- a/images/win/scripts/Installers/Install-SQLExpress.ps1 +++ b/images/win/scripts/Installers/Install-SQLExpress.ps1 @@ -70,7 +70,7 @@ $installerUrl = "https://go.microsoft.com/fwlink/?linkid=866658" $downloadPath = "C:\SQLInstall" $setupPath = Join-Path $downloadPath "SQLEXPR_x64_ENU" #Create directory for temporary files -md $downloadPath +mkdir $downloadPath Set-Location -Path $downloadPath $installerPath = Start-DownloadWithRetry -Url $installerUrl -DownloadPath $downloadPath -Name "SQL2019-SSEI-Expr.exe" Download-FullSQLPackage -InstallerPath $installerPath -DownloadPath $downloadPath @@ -78,4 +78,4 @@ Unpack-SQLInstaller -InstallPath "$setupPath.exe" $resultPath = Join-Path $setupPath "SETUP.exe" Start-Installer -InstallerPath $resultPath #Cleanup folder with installation packages. -Remove-Item $downloadPath -Recurse +Remove-Item $downloadPath -Recurse -Force From 8ecd0d93571767ef508c847f25ea101e212a622d Mon Sep 17 00:00:00 2001 From: "Dariy.Nurgaleev" Date: Fri, 27 Mar 2020 12:52:54 +0700 Subject: [PATCH 48/49] removed all mandatory parameters to verify build. --- images/win/scripts/Installers/Install-SQLExpress.ps1 | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/images/win/scripts/Installers/Install-SQLExpress.ps1 b/images/win/scripts/Installers/Install-SQLExpress.ps1 index 79956502..e3a6955e 100644 --- a/images/win/scripts/Installers/Install-SQLExpress.ps1 +++ b/images/win/scripts/Installers/Install-SQLExpress.ps1 @@ -6,7 +6,6 @@ Import-Module -Name ImageHelpers -Force; function Download-FullSQLPackage { param( - [Parameter(Mandatory)] [String]$InstallerPath, [String]$DownloadPath, [String]$Arguments = ("/MEDIAPATH=$DownloadPath", "/MEDIATYPE=Core","/Action=Download", "/QUIET") @@ -27,7 +26,6 @@ function Download-FullSQLPackage { function Unpack-SQLInstaller { param( - [Parameter(Mandatory)] [String]$InstallPath, [String]$Arguments = ("/Q", "/IACCEPTSQLSERVERLICENSETERMS") ) @@ -48,7 +46,6 @@ function Unpack-SQLInstaller { function Start-Installer { param( - [Parameter(Mandatory)] [String]$InstallerPath, [String]$Arguments = ("/Q", "/IACCEPTSQLSERVERLICENSETERMS", "/Action=Install", "/INSTANCEID=SQL2019", "/INSTANCENAME=SQL2019", "/SECURITYMODE=SQL", "/SAPWD=P@ssword!!", "/TCPENABLED=1") ) @@ -70,7 +67,7 @@ $installerUrl = "https://go.microsoft.com/fwlink/?linkid=866658" $downloadPath = "C:\SQLInstall" $setupPath = Join-Path $downloadPath "SQLEXPR_x64_ENU" #Create directory for temporary files -mkdir $downloadPath +md $downloadPath Set-Location -Path $downloadPath $installerPath = Start-DownloadWithRetry -Url $installerUrl -DownloadPath $downloadPath -Name "SQL2019-SSEI-Expr.exe" Download-FullSQLPackage -InstallerPath $installerPath -DownloadPath $downloadPath @@ -78,4 +75,4 @@ Unpack-SQLInstaller -InstallPath "$setupPath.exe" $resultPath = Join-Path $setupPath "SETUP.exe" Start-Installer -InstallerPath $resultPath #Cleanup folder with installation packages. -Remove-Item $downloadPath -Recurse -Force +Remove-Item $downloadPath -Recurse -Force \ No newline at end of file From a48d21f57ab731b24d59f0569ccd456d6f6abcba Mon Sep 17 00:00:00 2001 From: Dariy Nurgaleev <50947177+Darleev@users.noreply.github.com> Date: Mon, 30 Mar 2020 16:49:34 +0700 Subject: [PATCH 49/49] Create directory using native powershell tools --- images/win/scripts/Installers/Install-SQLExpress.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/images/win/scripts/Installers/Install-SQLExpress.ps1 b/images/win/scripts/Installers/Install-SQLExpress.ps1 index e3a6955e..f1913088 100644 --- a/images/win/scripts/Installers/Install-SQLExpress.ps1 +++ b/images/win/scripts/Installers/Install-SQLExpress.ps1 @@ -67,7 +67,7 @@ $installerUrl = "https://go.microsoft.com/fwlink/?linkid=866658" $downloadPath = "C:\SQLInstall" $setupPath = Join-Path $downloadPath "SQLEXPR_x64_ENU" #Create directory for temporary files -md $downloadPath +New-Item -Path $downloadPath -ItemType Directory Set-Location -Path $downloadPath $installerPath = Start-DownloadWithRetry -Url $installerUrl -DownloadPath $downloadPath -Name "SQL2019-SSEI-Expr.exe" Download-FullSQLPackage -InstallerPath $installerPath -DownloadPath $downloadPath @@ -75,4 +75,4 @@ Unpack-SQLInstaller -InstallPath "$setupPath.exe" $resultPath = Join-Path $setupPath "SETUP.exe" Start-Installer -InstallerPath $resultPath #Cleanup folder with installation packages. -Remove-Item $downloadPath -Recurse -Force \ No newline at end of file +Remove-Item $downloadPath -Recurse -Force