changed installation packages and cleanup

This commit is contained in:
Dariy Nurgaleev
2020-03-24 17:28:01 +07:00
committed by GitHub
parent 66a71260b4
commit d3ab1f0bb0

View File

@@ -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
Start-Installer -InstallerPath $resultPath
#Cleanup folder with installation packages.
Remove-Item $downloadPath -Recurse