s3 buckets to sync to Appstream directory


I have a on-demand AppStream which I would like to sync with a particular bucket in s3. In the AppStream config, it has the session start which kicks off a powershell task to sync the s3 bucket at start which works fine. However, I was trying to run this same powershell task during the session every 5 minutes. Since the on-demand image is sys prepped, I can’t use the scheduled task generated in Image Builder to create the scheduled task.
AWS support says the only recommendation they would provide is to create the scheduled task during the session start with a powershell script which creates the task. So, I have the powershell script to create the task running at startup as system. I think I see the powershell task being created at session start in the AppStream logs (provides task name and state). However, there no trace of the scheduled task can be found. This is where I am stumped.
Not sure that anybody else has had the need for something similar. Any feedback would be great!

asked 3 months ago52 views
2 Answers

Are you able to see the task created in the scheduled task? And what is the trigger for this scheduled task, only at startup or at startup and every 5 minutes there after. If you are running this task only at startup, it will not run because the startup phase has already passed but there is an option to add a delay which delays the task execution by specified time after startup I believe.

Also as far as I remember scheduled tasks persist after sysprep but I will need to double check this. I would recommend creating a support case for investigation.

answered 3 months ago
  • Hi Mayank, thanks for your attention. I am creating the task to run every 2 minutes. But I am open to scrutiny on the script. I did open a case with AWS. They said it falls under the customer responsibility. And I don't think AppStream will allow any different type of sysprep using the Image Builder.

    This is the script I have running in the Appstream config. Again, it doesn't appear to do what I would expect and I don't see it listed in task scheduler or in Get-ScheduledTask once the AppStream image is created.

    $ac = New-ScheduledTaskAction -Execute '"%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe' -Argument ('-File "C:\scripts\syncin1.ps1"') $tr = New-ScheduledTaskTrigger -Once -At (Get-Date) -RepetitionInterval (New-TimeSpan -Minutes 2) $sa = New-ScheduledTaskSettingsSet -Hidden $pr = New-ScheduledTaskPrincipal -UserID 'NT AUTHORITY\SYSTEM' -LogonType ServiceAccount -RunLevel Highest Register-ScheduledTask -TaskName 'SyncinTask' -Trigger $tr -Action $ac -Settings $sa -Principal $pr


Thank you for sharing the details. I will find some time to test it. However, syncing every 2 minutes doesn't seem to be a good idea if the files are big. It can take some time to upload/download the file between S3 and the fleet instance. If you don't configure the schedule task correctly, there may be to many tasks running in parallel which may cause performance issues. As for the case that you opened, I was not able to find it. Please ask the engineer owning the case to contact me by sharing this repost article on the case and I will work with him internally to find the solution.

answered 3 months ago
  • Hi Mayank, I am the engineer on this. My name is Sam and I can be reached as shsamuelhageman@gmail.com. The files were are operating with here are limited to csv files. Each csv file is 1-2 mb.

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