I've created a Custom App Block with Windows, including a setup.ps1 (PowerShell script) to mount my custom virtual disk to M: drive.
I modified the path, Windows environment variable, with this code below, and the output logs (in S3) indicate that the path was changed (I used Write-Host to see the updated path). However, when I stream the application, the path is not changed.
$jre = "W:\jre\bin"
$p = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + [IO.Path]::PathSeparator + $jre
[System.Environment]::SetEnvironmentVariable("Path", $p, "Machine")
$p = [System.Environment]::GetEnvironmentVariable("Path", "Machine")
Write-Host $p
# result
#C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\Amazon\cfn-bootstrap\;C:\Program Files\Amazon\Photon\ConsoleImageBuilder\;C:\Program Files\Amazon\Photon\AppBlockManager\CLI\;W:\jre\bin
Workaround
My workaround is copying a 'shim' batch file from the mounted virtual drive into a directory that is already in the path:
C:\Users\PhotonUser\AppData\Local\Microsoft\WindowsApps