flcdrg / au-packages

David's Chocolatey Automatic Packages
MIT License
18 stars 53 forks source link

Enables SQLSYSADMINACCOUNTS option in configuration.ini #110

Closed bjoernf73 closed 3 years ago

bjoernf73 commented 3 years ago

109

If you explicitly use the command line option /SQLSYSADMINACCOUNTS, the installer will ignore SQLSYSADMINACCOUNTS= in the configuration.ini. There is no change to this in this PR - this is how the installer works (command line options take presedence to configuration.ini)

Earlier, if you did not explicitly use the command line option /SQLSYSADMINACCOUNTS, chocolateyinstall.ps1 would add the command line option with the current (executing) user. So the command line option would always exist, and - since it take presedence over the ini - always override the SQLSYSADMINACCOUNTS= in configuration.ini.

The PR simply adds a test for the presence of the string SQLSYSADMINACCOUNTS= at the start of any line (i.e. "^SQLSYSADMINACCOUNTS=") in the configuration.ini, and only adds the command line option /SQLSYSADMINACCOUNTS with the default value if such a line could not be found.

Also changed the lines describing the command line option /SQLSYSADMINACCOUNTS: because the current implementation supports a single identity, not multiple. The installer expects something like /SQLSYSADMINACCOUNTS:DOMAN\User1 DOMAIN\Group2, but is always met with /SQLSYSADMINACCOUNTS:"DOMAN\User1 DOMAIN\Group2" - treating them as a single identity. However, as long as the ini-file option works, this is minor.

Tested with 'Test-Package'.