Ordres per instal·lar Microsoft SQL Server 2017 Express sense preguntes, desinstal·lar-lo i detectar-lo des d’eines de desplegament. Només es mostra una ordre quan és segura: la que indica el manifest o el valor per defecte documentat de la tecnologia de l’instal·lador.
Guia relacionada: Instal·lació silenciosa: MSI, NSIS, Inno Setup · Desinstal·lar un programa amb el registre o PowerShell
Amb winget
winget install --id Microsoft.SQLServer.2017.Express -e --silent --accept-package-agreements --accept-source-agreementswinget upgrade --id Microsoft.SQLServer.2017.Express -e --silentwinget uninstall --id Microsoft.SQLServer.2017.Express -e --silentPer instal·lador
64 bits · EXE · en-US
SQLServer2017-SSEI-Expr.exe /IACCEPTSQLSERVERLICENSETERMS /ENU /ACTION=Install /quiet /InstallPath="c:\Program Files\Microsoft SQL Server"PowerShell: baixar, verificar, instal·lar
Baixa el fitxer oficial, en comprova l’SHA256 i l’instal·la en mode silenciós.
$url = 'https://download.microsoft.com/download/5/E/9/5E9B18CC-8FD5-467E-B5BF-BADE39C51F73/SQLServer2017-SSEI-Expr.exe'
$sha256 = 'D8A5CD8F4380BE195AF82D0DDC21316713AB2B41FF6C48D86F87C5778DE18411'
$file = Join-Path $env:TEMP 'SQLServer2017-SSEI-Expr.exe'
Invoke-WebRequest -Uri $url -OutFile $file -UseBasicParsing
if ((Get-FileHash $file -Algorithm SHA256).Hash -ne $sha256) { throw 'SHA256 mismatch' }
Start-Process -FilePath $file -ArgumentList '/IACCEPTSQLSERVERLICENSETERMS /ENU /ACTION=Install /quiet /InstallPath="c:\Program Files\Microsoft SQL Server"' -Wait