Automate Session Hosts with the Script Repository

Keep your PowerShell scripts in one library, import them from the Atlas AVD Scripts Repository or a public GitHub repository, and more.

Before you begin

  • The Starter plan or higher
  • The Scripts module turned on in Settings → Modules
  • The pool.policy.push permission to see Scripts in the sidebar. Only administrators have it by default.
  • The scripts.manage permission to create, edit, import, assign, or delete scripts. Administrators and operators have it by default.

Where to find it

Go to Workspace → Scripts. The page is titled Script Repository. At the top, the metrics bar shows Total Scripts, Assigned Scripts, Executions (Last 24h), and Failed Executions. Below it is the script list, which you can search, sort, and filter by folder, category, and tag. The filter chips All, Active, Unassigned, Failing, and Never Run narrow the list to scripts in that state.

Write a new script

  1. Click New Script. The Create New Script editor opens.
  2. Enter a Name and, optionally, a Description.
  3. Choose a Folder to file it in, or create one. Add Tags to make the script easier to find later.
  4. Type or paste your script into the PowerShell Script editor. The editor has syntax highlighting, snippets, Format, word wrap, and a fullscreen mode.
  5. Optionally, declare Parameters: the positional arguments the script takes, in order, each with a name, description, default value, and whether it is required.
  6. Click Save Script, or press Ctrl+S.

Already have the script as a file? Click Upload .ps1 to load a .ps1 file of up to 1 MB into the editor, then review it and save.

Import a script

You do not have to start from scratch. There are two ways to import:

  • Import from Repository opens Import from Atlas AVD Scripts Repository, a curated set of ready-made Atlas AVD scripts. Pick a script, check the preview, and click Import Script.
  • Browse Public GitHub lets you enter any public GitHub repository, as owner/repository or a full GitHub URL, and lists its .ps1 files. Preview a file, give it a name, and import it. Private repositories are not supported here.

Imported scripts run on your session hosts. Read the preview carefully before importing anything from a repository you do not control.

Keep GitHub imports up to date

Scripts you import from a public GitHub repository are listed under Imported from Public GitHub, with the repository, the file, when it was last synced, and its status. Click Sync to pull the latest version from GitHub. If nothing has changed, Atlas tells you it is already up to date.

Assign a script to host pools

A script does nothing until it is assigned. Open a script's actions menu and choose Assign to Host Pools.

  1. Select Host Pools: choose one or more host pools.
  2. Execution Type: choose when the script runs. On Provisioning / First Boot runs once, when a session host is first provisioned. Every Startup runs each time a session host starts.
  3. Confirm: review the assignment and click Confirm Assignment.

The script is queued for the selected host pools, so it may not take effect immediately. An On Provisioning / First Boot script runs on new session hosts the next time they boot; it does not re-run on hosts that already exist. You can also pick host pools for each trigger directly in the script editor.

Manage assignments and versions

  • Manage Host Pools lists the host pools a script is assigned to and the trigger for each. Click the X next to a host pool to stop the script running there. To add host pools, use Assign to Host Pools or the script editor.
  • Version History keeps every saved version of a script. View any version, compare it with the current one, and choose Restore this version to roll back.
  • Expanding a script in the list shows its details, the host pools it is assigned to, and its recent executions with their result.
  • Deleting a script asks you to type its name to confirm. If it is assigned, it is detached from every host pool and stops running there.

Run a script on Atlas Reach devices

For PowerShell, CMD, and Batch scripts, the actions menu also offers Run via Atlas Reach…. It opens Atlas Reach with the script already selected, so you can run it on the devices you choose there. Any Parameters you declared appear as inputs in the run dialog.

Automation Insights

The Automation Insights panel points out scripts that need attention, with a link that filters the list to them:

  • Scripts that are unassigned and not deployed to any host pool.
  • Scripts whose last execution failed.
  • Assigned scripts that have never run.

Next steps