-1

i try to install SQLEXPRADV_x64 "manual" with Install-ChocolateyPackage on an Azure Hosted Agent (Windows-Latest). I do manual as there is no Express Advanced Version available.

Error is: The term 'Install-ChocolateyPackage' is not recognized as the name of a cmdlet, function

And I can't find the fitting solution in the documentation. The CMDLET should be available on the Agent?

    - powershell: |
              $silentArgs = "/IACCEPTSQLSERVERLICENSETERMS /Q /ACTION=install /INSTANCEID=SQLEXPRESS /INSTANCENAME=SQLEXPRESS /UPDATEENABLED=FALSE"
              $fileFullPath = "SQLEXPRADV_x64_ENU.exe"
              $packageName = "MsSqlServer2016ExpressAdv"
              $chocolateyTempDir = Join-Path (Get-Item $env:TEMP).FullName "chocolatey"
              $tempDir = Join-Path $chocolateyTempDir $packageName
              $extractPath = "$tempDir\SQLEXPRADV"
              $setupPath = "$extractPath\setup.exe"
              Write-Host "Extracting to " $extractPath
              Start-Process "$fileFullPath" "/Q /x:`"$extractPath`"" -Wait
              Install-ChocolateyPackage "$packageName" "EXE" "$silentArgs" "$setupPath" -validExitCodes @(0, 3010)
      displayName: 'install sql express database'
Tobi
  • 109
  • 1
  • 1
  • 12

1 Answers1

0

grzegorz-ochlik is correct: Why is the Uninstall-ChocolateyPackage cmdlet not recognized?

I solved it without Chocolatey by just using Start-Process

- powershell: |
              $silentArgs = "/IACCEPTSQLSERVERLICENSETERMS /Q /ACTION=install /INSTANCEID=SQLEXPRESS02 /INSTANCENAME=SQLEXPRESS /UPDATEENABLED=FALSE"
              $fileFullPath = "SQLEXPRADV_x64_ENU.exe"
              $packageName = "MsSqlServer2019ExpressAdv"
              $currentlocation = Get-Location
              $tempDir = Join-Path $currentlocation $packageName
              $extractPath = "$tempDir\SQLEXPRADV"
              $setupPath = "$extractPath\setup.exe"
              Write-Host "Extracting to " $extractPath
              Start-Process "$fileFullPath" "/Q /x:`"$extractPath`"" -Wait
              Start-Process $setupPath -ArgumentList $silentArgs
  displayName: 'install sql express database'
Tobi
  • 109
  • 1
  • 1
  • 12