I have a Windows VM on Azure. On startup it runs powershell script:
Start-Process cmd.exe -ArgumentList "/c whoami.exe 1> c:\whoami.log 2>&1" -wait
$tempPath = "$env:TEMP"
$exePath = "$tempPath\vs_buildtools.exe"
Invoke-WebRequest -Uri https://aka.ms/vs/17/release/vs_BuildTools.exe -UseBasicParsing -OutFile $exePath
Start-Process cmd.exe -ArgumentList "/c $exePath --quiet --add Microsoft.VisualStudio.Component.TestTools.BuildTools 1> c:\vs_buildtools.log 2>&1" -Wait
After creating the VM:
- whoami.exe works fine and writes nt authority\system to c:\whoami.log file.
- vs_buildtools.exe is downloaded to C:\Windows\Temp
- BuildTools doesn't install anything. There is no dd_* log files in temp folder.
- c:\vs_buildtools.log contains this error message:
The application cannot find one of its required files, possibly because it was unable to create it in the folder. Please make sure that the folder in which this application was downloaded is accessible and not read-only.
When I run the script via RDP it works fine and writes dd_* log files to temp folder.
Aslo I tried -Verb runAs. Same issue.