0

I'm trying to override the default package parameters but don't manage to get it taken by chocolatey, after some research and syntax studies here below is what I'm triggering, in a powershell prompt.

Looking at the variable InstallArguments it seems the arguments are taken and properly overwritten, but then when I look at the $silentArgs the default arguments from the package are taken in the install command, I don't understand where my mistake is, should I add other parameters?

Any input would be much welcome.

InstallArguments='/IACCEPTSQLSERVERLICENSETERMS /Q /ACTION=install /UPDATEENABLED=FALSE /FEATURES=SQL,TOOLS,FULLTEXT'|
[…]
OverrideArguments='True'|NotSilent='False'|
$silentArgs = "/IACCEPTSQLSERVERLICENSETERMS /Q /ACTION=install /INSTANCEID=SQLEXPRESS /INSTANCENAME=SQLEXPRESS /UPDATEENABLED=FALSE"
[…]

Install-ChocolateyInstallPackage "$packageName" "EXE" "$silentArgs" "$setupPath" -validExitCodes @(0, 3010)

Full debug output

PS C:\Users\Administrator> choco install MsSqlServer2014Express --force --noop --debug -o -ia "'/IACCEPTSQLSERVERLICENSETERMS /Q /ACTION=install /UPDATEENABLED=FALSE /FEATURES=SQL,TOOLS,FULLTEXT'"
Chocolatey v0.10.11
Chocolatey is running on Windows v 6.3.9600.0
Command line: "C:\ProgramData\chocolatey\choco.exe" install MsSqlServer2014Express --force --noop --debug -o -ia "'/IACCEPTSQLSERVERLICENSETERMS /Q /ACTION=install /UPDATEENABLED=FALSE /FEATURES=SQL,TOOLS,FULLTEXT'"
Received arguments: install MsSqlServer2014Express --force --noop --debug -o -ia '/IACCEPTSQLSERVERLICENSETERMS /Q /ACTION=install /UPDATEENABLED=FALSE /FEATURES=SQL,TOOLS,FULLTEXT'
The source 'https://chocolatey.org/api/v2/' evaluated to a 'normal' source type

NOTE: Hiding sensitive configuration data! Please double and triple
 check to be sure no sensitive data is shown, especially if copying
 output to a gist for review.
Configuration: CommandName='install'|CacheLocation='c:\vagrant\Softs\chocolatey_temp'|
ContainsLegacyPackageInstalls='True'|
CommandExecutionTimeoutSeconds='2700'|WebRequestTimeoutSeconds='30'|
Sources='https://chocolatey.org/api/v2/'|SourceType='normal'|
Debug='True'|Verbose='False'|Trace='False'|Force='True'|Noop='True'|
HelpRequested='False'|UnsuccessfulParsing='False'|RegularOutput='True'|
QuietOutput='False'|PromptForConfirmation='False'|
AcceptLicense='False'|
AllowUnofficialBuild='False'|Input='MsSqlServer2014Express'|
AllVersions='False'|SkipPackageInstallProvider='False'|
PackageNames='MsSqlServer2014Express'|Prerelease='False'|
ForceX86='False'|
InstallArguments='/IACCEPTSQLSERVERLICENSETERMS /Q /ACTION=install /UPDATEENABLED=FALSE /FEATURES=SQL,TOOLS,FULLTEXT'|

OverrideArguments='True'|NotSilent='False'|
ApplyPackageParametersToDependencies='False'|
ApplyInstallArgumentsToDependencies='False'|IgnoreDependencies='False'|
AllowMultipleVersions='False'|AllowDowngrade='False'|
ForceDependencies='False'|Information.PlatformType='Windows'|
Information.PlatformVersion='6.3.9600.0'|
Information.PlatformName='Windows Server 2012 R2'|
Information.ChocolateyVersion='0.10.11.0'|
Information.ChocolateyProductVersion='0.10.11'|
Information.FullName='choco, Version=0.10.11.0, Culture=neutral, PublicKeyToken=79d02ea9cad655eb'|

Information.Is64BitOperatingSystem='True'|
Information.Is64BitProcess='True'|Information.IsInteractive='True'|
Information.UserName='Administrator'|
Information.UserDomainName='GALAXY'|
Information.IsUserAdministrator='True'|
Information.IsUserSystemAccount='False'|
Information.IsUserRemoteDesktop='False'|
Information.IsUserRemote='False'|Information.IsProcessElevated='True'|
Information.IsLicensedVersion='False'|Information.LicenseType='Foss'|
Features.AutoUninstaller='True'|Features.ChecksumFiles='True'|
Features.AllowEmptyChecksums='False'|
Features.AllowEmptyChecksumsSecure='True'|
Features.FailOnAutoUninstaller='False'|
Features.FailOnStandardError='False'|Features.UsePowerShellHost='True'|
Features.LogEnvironmentValues='False'|Features.LogWithoutColor='False'|
Features.VirusCheck='False'|
Features.FailOnInvalidOrMissingLicense='False'|
Features.IgnoreInvalidOptionsSwitches='True'|
Features.UsePackageExitCodes='True'|
Features.UseFipsCompliantChecksums='False'|
Features.ShowNonElevatedWarnings='True'|
Features.ShowDownloadProgress='True'|
Features.StopOnFirstPackageFailure='False'|
Features.UseRememberedArgumentsForUpgrades='False'|
Features.IgnoreUnfoundPackagesOnUpgradeOutdated='False'|
Features.RemovePackageInformationOnUninstall='False'|
Features.ScriptsCheckLastExitCode='False'|
ListCommand.LocalOnly='False'|
ListCommand.IdOnly='False'|ListCommand.IncludeRegistryPrograms='False'|
ListCommand.PageSize='25'|ListCommand.Exact='False'|
ListCommand.ByIdOnly='False'|ListCommand.ByTagOnly='False'|
ListCommand.IdStartsWith='False'|ListCommand.OrderByPopularity='False'|
ListCommand.ApprovedOnly='False'|
ListCommand.DownloadCacheAvailable='False'|
ListCommand.NotBroken='False'|
ListCommand.IncludeVersionOverrides='False'|
UpgradeCommand.FailOnUnfound='False'|
UpgradeCommand.FailOnNotInstalled='False'|
UpgradeCommand.NotifyOnlyAvailableUpgrades='False'|
UpgradeCommand.ExcludePrerelease='False'|
NewCommand.AutomaticPackage='False'|
NewCommand.UseOriginalTemplate='False'|SourceCommand.Command='unknown'|
SourceCommand.Priority='0'|SourceCommand.BypassProxy='False'|
SourceCommand.AllowSelfService='False'|
SourceCommand.VisibleToAdminsOnly='False'|
FeatureCommand.Command='unknown'|ConfigCommand.Command='unknown'|
PinCommand.Command='unknown'|OutdatedCommand.IgnorePinned='False'|
Proxy.BypassOnLocal='True'|
_ Chocolatey:ChocolateyInstallCommand - Noop Mode _
Chocolatey would have used NuGet to install packages (if they are not already installed):
MsSqlServer2014Express
Progress: Downloading MsSqlServer2014Express 12.2.5000.20170905... 100%
[NuGet] Added file 'ChocolateyInstall.ps1' to folder 'MsSqlServer2014Express\tools'.
[NuGet] Added file 'ChocolateyUninstall.ps1' to folder 'MsSqlServer2014Express\tools'.
[NuGet] Added file 'MsSqlServer2014Express.nuspec' to folder 'MsSqlServer2014Express'.
[NuGet] Added file 'MsSqlServer2014Express.nupkg' to folder 'MsSqlServer2014Express'.

MsSqlServer2014Express v12.2.5000.20170905 (forced) [Approved]
Would have run 'ChocolateyInstall.ps1':
$packageName = "MsSqlServer2014Express"
$chocolateyTempDir = Join-Path (Get-Item $env:TEMP).FullName "chocolatey"
$tempDir = Join-Path $chocolateyTempDir $packageName
$fileFullPath = "$tempDir\SQLEXPR.exe"
$extractPath = "$tempDir\SQLEXPR"
$setupPath = "$extractPath\setup.exe"
$silentArgs = "/IACCEPTSQLSERVERLICENSETERMS /Q /ACTION=install /INSTANCEID=SQLEXPRESS /INSTANCENAME=SQLEXPRESS /UPDATEENABLED=FALSE"
$url = "https://download.microsoft.com/download/2/A/5/2A5260C3-4143-47D8-9823-E91BB0121F94/SQLEXPR_x86_ENU.exe"
$url64 = "https://download.microsoft.com/download/2/A/5/2A5260C3-4143-47D8-9823-E91BB0121F94/SQLEXPR_x64_ENU.exe"
$checksum = '0eff1354916410437c829e98989e5910d9605b2df31977bc33ca492405a0a9ab'
$checksum64 = 'cc35e94030a24093a62e333e900c2e3c8f1eb253a5d73230a9f5527f1046825b'

# Using the same download location as Install-ChocolateyPackage but need to create the directory first
if (![System.IO.Directory]::Exists($tempDir)) { [System.IO.Directory]::CreateDirectory($tempDir) | Out-Null }
Get-ChocolateyWebFile $packageName $fileFullPath $url $url64 -Checksum $checksum -Checksum64 $checksum64 -ChecksumType "sha256"

Write-Host "Extracting..."
Start-Process "$fileFullPath" "/Q /x:`"$extractPath`"" -Wait

Write-Host "Installing..."
Install-ChocolateyInstallPackage "$packageName" "EXE" "$silentArgs" "$setupPath" -validExitCodes @(0, 3010)

Write-Host "Removing extracted files..."
rm -r "$extractPath"
Exiting with 0
henrycarteruk
  • 12,708
  • 2
  • 36
  • 40
Matthieu Ducorps
  • 170
  • 1
  • 1
  • 16

1 Answers1

0

My understanding is it because of the noop mode where the variable are not fully updated like is done when you run it for real, you will get this feedback which shows the parameters are effectively overwritten.

Overriding package arguments with '/IACCEPTSQLSERVERLICENSETERMS /Q /ACTION=install /UPDATEENABLED=FALSE /FEATURES=SQL,TOOLS,FULLTEXT' (replacing '/IACCEPTSQLSERVERLICENSETERMS /Q /ACTION=install /INSTANCEID=SQLEXPRESS /INSTANCENAME=SQLEXPRESS /UPDATEENABLED=FALSE')

hope that help. Matth

Matthieu Ducorps
  • 170
  • 1
  • 1
  • 16