From 2249d5db85d6196f039ed80eed5f15eebd42b2a3 Mon Sep 17 00:00:00 2001 From: Vladimir Safonkin Date: Wed, 6 May 2020 13:15:34 +0300 Subject: [PATCH] Fix maven environment variable (#831) --- images/win/scripts/Installers/Install-JavaTools.ps1 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/images/win/scripts/Installers/Install-JavaTools.ps1 b/images/win/scripts/Installers/Install-JavaTools.ps1 index 8ab75910c..455283d09 100644 --- a/images/win/scripts/Installers/Install-JavaTools.ps1 +++ b/images/win/scripts/Installers/Install-JavaTools.ps1 @@ -63,8 +63,7 @@ Choco-Install -PackageName maven -ArgumentList "-i", "--version=3.6.3" Choco-Install -PackageName gradle # Move maven variables to Machine. They may not be in the environment for this script so we need to read them from the registry. -$userSid = (Get-WmiObject win32_useraccount -Filter "name = '$env:USERNAME' AND domain = '$env:USERDOMAIN'").SID -$userEnvironmentKey = 'Registry::HKEY_USERS\' + $userSid + '\Environment' +$userEnvironmentKey = 'Registry::HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment' $m2_home = (Get-ItemProperty -Path $userEnvironmentKey -Name M2_HOME).M2_HOME $m2 = $m2_home + '\bin'