diff --git a/CHANGELOG.md b/CHANGELOG.md index abe7546a7..1bf3e0fa4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,9 @@ - Added a new helper function `Get-InstalledSharedFeatures` to move out some of the code from the `Get-TargetResource` to make unit testing easier and faster. + - Changed the logic of 'Build the argument string to be passed to setup' to + not quote the value if root directory is specified + ([issue #1254](https://github.com/PowerShell/SqlServerDsc/issues/1254)). ## 12.3.0.0 diff --git a/DSCResources/MSFT_SqlSetup/MSFT_SqlSetup.psm1 b/DSCResources/MSFT_SqlSetup/MSFT_SqlSetup.psm1 index 6f59e3715..e26c91724 100644 --- a/DSCResources/MSFT_SqlSetup/MSFT_SqlSetup.psm1 +++ b/DSCResources/MSFT_SqlSetup/MSFT_SqlSetup.psm1 @@ -1574,7 +1574,16 @@ function Set-TargetResource } else { - $setupArgumentValue = '"{0}"' -f $currentSetupArgument.Value + # Logic added as a fix for Issue#1254 SqlSetup:Fails when a root directory is specified + if($currentSetupArgument.Value -match '^[a-zA-Z]:\\$') + { + $setupArgumentValue = $currentSetupArgument.Value + } + else + { + $setupArgumentValue = '"{0}"' -f $currentSetupArgument.Value + } + } } diff --git a/Tests/Unit/MSFT_SqlSetup.Tests.ps1 b/Tests/Unit/MSFT_SqlSetup.Tests.ps1 index 2280713c0..84c79d68a 100644 --- a/Tests/Unit/MSFT_SqlSetup.Tests.ps1 +++ b/Tests/Unit/MSFT_SqlSetup.Tests.ps1 @@ -3348,6 +3348,7 @@ try It 'Should set the system in the desired state when feature is SQLENGINE' { $testParameters = $mockDefaultParameters.Clone() + # This is also used to regression test issue #1254, SqlSetup fails when root directory is specified. $testParameters += @{ SQLSysAdminAccounts = 'COMPANY\User1','COMPANY\SQLAdmins' ASSysAdminAccounts = 'COMPANY\User1','COMPANY\SQLAdmins'