If you use the configuration parameter option
$config = @{
ACTION="Upgrade"
}
You will get this error: The setting 'FEATURES' is not allowed when the value of setting 'ACTION' is 'Upgrade'. The workaround is to use a configuration file to override the FEATURES option that the configuration parameter adds by default. The configuration file must have a least these three options: ACTION, INSTANCENAME, and QUIETThe following example does a remote upgrade of a named instance to SQL 2022
$options = '
[OPTIONS]
ACTION="Upgrade"
INSTANCENAME="instance_name"
QUIET="True"
'
Set-Content -Path 'c:\temp\config.ini' -Value $options
$paramsUpgrade = @{
ComputerName = 'computer_name'
Version = '2022'
Path = 'sql_install_path’
UpdateSourcePath = 'sql_cu_path’
ConfigurationFile = 'c:\temp\config.ini'
Restart = $true
Credential = Get-Credential
Confirm = $false
}
Install-DbaInstance @paramsUpgrade