From f4b6db83dda9284b534545065d7f5daaf1f9cbbb Mon Sep 17 00:00:00 2001 From: andreasjordan Date: Mon, 11 Mar 2024 11:26:07 +0100 Subject: [PATCH] Fix issue with paths ending with backslash (do Install-DbaInstance) --- public/Install-DbaInstance.ps1 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/public/Install-DbaInstance.ps1 b/public/Install-DbaInstance.ps1 index 609f1c2e30..ef3f5be416 100644 --- a/public/Install-DbaInstance.ps1 +++ b/public/Install-DbaInstance.ps1 @@ -356,6 +356,9 @@ function Install-DbaInstance { } else { if ($origVal -is [int]) { $origVal = "$origVal" + } elseif ($origVal -match '[^\\]\\$') { + # In case a value ends with a single backslash, add a second backslash to prevent escaping the following double quotation mark. + $origVal = "$origVal\" } if ($origVal -ne $origVal.Trim('"')) { $output += "$sectionKey=$origVal"