- Newest
- Most votes
- Most comments
There are a few potential reasons why your AppStream 2.0 session script may not be executing during user sessions:
-
Timing of script execution: Session start scripts are executed before the APPSTREAM_SESSION_CONTEXT variable is created and set. This means the script runs very early in the session startup process, possibly before some resources are fully available.
-
Script permissions: Ensure that the script has the correct permissions to run. Users should not have permission to modify session script files, but the system needs to be able to execute them.
-
Script location and configuration: Verify that the script is correctly specified in the session scripts configuration file (config.json). For Windows instances, this file should be located at C:\AppStream\SessionScripts\config.json.
-
Script content: Make sure your script is idempotent (can run multiple times without issues) and doesn't rely on resources that may not be available at the very start of a session.
-
Logging configuration: Check if S3 logging is enabled for your script in the config.json file. If S3LogEnabled is set to true, ensure that you have properly configured an S3 bucket to receive the logs.
-
Script runtime: Verify that the WaitingTime parameter in the config.json is set to an appropriate value, giving your script enough time to complete its tasks.
To troubleshoot:
- Review your config.json file to ensure the script is correctly specified.
- Check the script's permissions and location.
- Add explicit logging at the beginning and end of your script to verify if it's being executed at all.
- Consider using simpler scripts initially to test the execution, then gradually add complexity.
- Ensure that the script file type is supported (.bat, .exe, or .ps1 for PowerShell).
If these steps don't resolve the issue, you may need to review the AppStream 2.0 instance's system logs for any error messages related to script execution.
Sources
AppStream env variable for session-context contains last session's context during startup script - bug or feature? | AWS re:Post
Creating Session Scripts - Amazon AppStream 2.0
Use Session Scripts to Manage Your Amazon AppStream 2.0 Users' Streaming Experience - Amazon AppStream 2.0
Session Scripts Configuration File - Amazon AppStream 2.0
Relevant content
- asked a year ago
- AWS OFFICIALUpdated 9 months ago