From bb2068282da5c1c636b6df0f6165935dbb4a4edd Mon Sep 17 00:00:00 2001
From: shanoor <shanoor@users.noreply.github.com>
Date: Wed, 7 Mar 2018 21:50:21 +0400
Subject: [PATCH] Make use of the $Admin parameter in create-vmfleet.ps1

It prevents a "Path not found"error when running the script on a non English version of Windows Server.
---
 Frameworks/VMFleet/create-vmfleet.ps1 | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Frameworks/VMFleet/create-vmfleet.ps1 b/Frameworks/VMFleet/create-vmfleet.ps1
index 3dc5997..9cdf248 100644
--- a/Frameworks/VMFleet/create-vmfleet.ps1
+++ b/Frameworks/VMFleet/create-vmfleet.ps1
@@ -139,7 +139,7 @@ icm $nodes -ArgumentList $stopafter,(Get-Command Stop-After) {
         $ok = $ok -band $?
         $null = reg add 'HKLM\tmp\Microsoft\Windows NT\CurrentVersion\WinLogon' /f /v AutoAdminLogon /t REG_DWORD /d 1
         $ok = $ok -band $?
-        $null = reg add 'HKLM\tmp\Microsoft\Windows NT\CurrentVersion\WinLogon' /f /v Shell /t REG_SZ /d 'powershell.exe -noexit -command c:\users\administrator\launch.ps1'
+        $null = reg add 'HKLM\tmp\Microsoft\Windows NT\CurrentVersion\WinLogon' /f /v Shell /t REG_SZ /d "powershell.exe -noexit -command c:\users\$Admin\launch.ps1"
         $ok = $ok -band $?
         $null = [gc]::Collect()
         $ok = $ok -band $?
@@ -159,8 +159,8 @@ icm $nodes -ArgumentList $stopafter,(Get-Command Stop-After) {
             return $ok
         }
 
-        del -Force z:\users\administrator\launch.ps1 -ErrorAction SilentlyContinue
-        gc C:\ClusterStorage\collect\control\launch-template.ps1 |% { $_ -replace '__CONNECTUSER__',$using:connectuser -replace '__CONNECTPASS__',$using:connectpass } > z:\users\administrator\launch.ps1
+        del -Force "z:\users\$Admin\launch.ps1" -ErrorAction SilentlyContinue
+        gc C:\ClusterStorage\collect\control\launch-template.ps1 |% { $_ -replace '__CONNECTUSER__',$using:connectuser -replace '__CONNECTPASS__',$using:connectpass } > "z:\users\$Admin\launch.ps1"
         $ok = $ok -band $?
         if (-not $ok) {
             Write-Error "failed injection of launch.ps1 for $vhdpath"