From a2ebaa9bbde0ff41182010dceffa40f1f84dfc30 Mon Sep 17 00:00:00 2001 From: Josiah Bradley Date: Mon, 9 Aug 2021 17:39:51 -0700 Subject: [PATCH] Escape passwords that use special characters. This is a patch for Issue 60: https://github.com/microsoft/diskspd/issues/60 When using a password that replaces __CONNECTPASS__ that has special characters such as ',",* the command on line 36 no longer causes a syntax error. --- Frameworks/VMFleet/launch-template.ps1 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Frameworks/VMFleet/launch-template.ps1 b/Frameworks/VMFleet/launch-template.ps1 index 439df37..c73f267 100644 --- a/Frameworks/VMFleet/launch-template.ps1 +++ b/Frameworks/VMFleet/launch-template.ps1 @@ -26,9 +26,13 @@ SOFTWARE. #> $script = 'c:\run\master.ps1' +<# prevent password injection errors when password contains ',"",*, etc. #> +$password = @' +__CONNECTPASS__ +'@ while ($true) { Write-Host -fore Green Launching $script `@ $(Get-Date) - & $script -connectuser __CONNECTUSER__ -connectpass __CONNECTPASS__ + & $script -connectuser __CONNECTUSER__ -connectpass $password sleep -Seconds 1 }