I have a PowerShell script that checks the storage connector registry key to get the mount status at startup but it never returns any value and eventually exceeds the 60 seconds limit.
$regHive = "HKLM:\SOFTWARE\Amazon\AppStream\Storage\$Env:AppStream_UserName"
function Get-HomeFolderMountStatus {
Get-ChildItem -Path $regHive `
| Where-Object { $_.Name.EndsWith('HomeFolder') } `
| Get-ItemPropertyValue -Name MountStatus
}
Write-Output "Mount status: $(Get-HomeFolderMountStatus)"
while ("$(Get-HomeFolderMountStatus)" -ne '2') {
Start-Sleep -Seconds 3
Write-Output "Mount status: $(Get-HomeFolderMountStatus)"
}
...
Upon checking the logs the value for MountStatus is null
Mount status:
Mount status:
...
The session script has not completed within the configured waiting time of 60000 ms. Logs will be truncated shortly after this point.
But if I test the script during the session it works and Mount Status is 2.
So why doesn't the registry lookup return a value for MountStatus when run as a start script?