microsoft/diskspd

New-Fleet ConnectPass parameter special characters handling

rosenbom opened this issue · 1 comments

The issue:
if ConnectPass contains "," or some other special characters, run.ps1 inside VM will fail, because "connectpass" parameter is passed as is (no quotes).

VMFleet line 2331 replaces parameters in the VM script:
(Get-Command Set-FleetLauncherScript).ScriptBlock |% {
$_ -replace 'CONNECTUSER',$using:connectuser -replace 'CONNECTPASS',$using:connectpass
} > z:\users\administrator\launch.ps1

The fix is easy, just single quotes to $using:connectpass. Unfortunately, github editor doesn't allow to put escape char - it assumes it's a code block, so I'm replacing it with "&esc"

Repro:
non-working:
$p = "A1B2C3,D4E5F6!"
$string = New-Object psobject
$c = "&esc$string | Add-Member -MemberType NoteProperty -Name pass -Value CONNPWD"
$c2 = $c -replace 'CONNPWD',$p
Invoke-Expression $c2
$string.pass
working:
$p = "A1B2&esc"C3,D4E5F6!"
$string = New-Object psobject
$c = "&esc$string | Add-Member -MemberType NoteProperty -Name pass -Value CONNPWD"
$c2 = $c -replace 'CONNPWD',"&esc'$p&esc'"
Invoke-Expression $c2
$string.pass

Yes, still some special chars needs additional handling, but at least it's better than nothing.

Thanks,
Dmitry.

dl2n commented

This should be fixed in the newest version.