Forum Discussion
JamesA1005
Oct 07, 2024Copper Contributor
Azure scheduled task powershell script not running on remote app but runs on full desktop
Hello, Just wondering if anyone has any thoughts or can help. I am running a powershell script to map a drive on an azure virtual desktop. The script will map the drive if I log in to a full desktop...
balasubramanim
Oct 07, 2024Iron Contributor
Please try these option to resolve the issue
1. Execution Context: RemoteApp may not run scripts in the same user context. Try setting up the script to run using Task Scheduler when the user logs in.
2. Use New-PSDrive: Change your script to use New-PSDrive with the -Persist option. This can help with drive visibility in RemoteApp.
3. Check Execution Policy: Make sure PowerShell’s execution policy allows your script to run.
4. Log Errors: Add logging to your script to capture any errors
I hope this helps.
Many Thanks
Balasubramani.M
JamesA1005
Oct 08, 2024Copper Contributor
Hi Thanks for the reply. In reposonse to your points
1. Execution Context: RemoteApp may not run scripts in the same user context. Try setting up the script to run using Task Scheduler when the user logs in.
This is how I am running the script
2. Use New-PSDrive: Change your script to use New-PSDrive with the -Persist option. This can help with drive visibility in RemoteApp.
I am using the -persist option. If the user logs in to the desktop the mapping stays and works for future login's
3. Check Execution Policy: Make sure PowerShell’s execution policy allows your script to run.
The script works fine for the full desktop and I've tested with a storage account key which still doesn't work
4. Log Errors: Add logging to your script to capture any errors
I will try setting this up
1. Execution Context: RemoteApp may not run scripts in the same user context. Try setting up the script to run using Task Scheduler when the user logs in.
This is how I am running the script
2. Use New-PSDrive: Change your script to use New-PSDrive with the -Persist option. This can help with drive visibility in RemoteApp.
I am using the -persist option. If the user logs in to the desktop the mapping stays and works for future login's
3. Check Execution Policy: Make sure PowerShell’s execution policy allows your script to run.
The script works fine for the full desktop and I've tested with a storage account key which still doesn't work
4. Log Errors: Add logging to your script to capture any errors
I will try setting this up