Appstream Session Script not executing during User Session

0

Hi,

I have an appstream session script that is meant to execute at the start of every user session. It is meant to run a script that configures the system for the user. When I run the script manually in Powershell (as Admin in Appstream Image Builder), it works okay and does what I need it to do. However, during a user session, the script doesnt look like it running, all the logs are empty as well.

EDIT The system context is setting up the system as expected and returning expected logs. When I log in to the application, the user context part of the session is not executing to download the relevant files needs for each user

Any help with this issue will be gretaly appreciated

asked a month ago90 views
1 Answer
0

There are a few potential reasons why your AppStream 2.0 session script may not be executing during user sessions:

  1. 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.

  2. 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.

  3. 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.

  4. 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.

  5. 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.

  6. 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:

  1. Review your config.json file to ensure the script is correctly specified.
  2. Check the script's permissions and location.
  3. Add explicit logging at the beginning and end of your script to verify if it's being executed at all.
  4. Consider using simpler scripts initially to test the execution, then gradually add complexity.
  5. 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

profile picture
answered a month ago
AWS
SUPPORT ENGINEER
reviewed a month ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions