Deployment Packages PowerShell Module
AthenaDeploymentPackages is a dedicated PowerShell module that scripts the entire
Athena deployment-package workflow end to end: sign in, build ordered steps, create/update/delete
packages, upload/list/remove package files, rebuild the bundle, deploy to agents, tags or
collections, and poll an execution until it finishes. It wraps the same
api/deployment-packages endpoints used by the console, so anything you can do in the
Deployments UI can be automated. For the field-by-field step reference (step
types, OS conditions, run-as, exit codes) see
Deployment Package Steps.
The general-purpose Athena PowerShell module includes
package cmdlets (create, get, and deploy), but has no dedicated commands for uploading or
removing package files, rebuilding the bundle, building steps, or waiting on an execution — those
need raw calls. AthenaDeploymentPackages is a purpose-built, standalone module that
adds all of those as first-class cmdlets, so the whole
create → upload → build → deploy → wait loop is scriptable
without any hand-written HTTP.
Requirements & roles#
- PowerShell 7 or newer. The module relies on PowerShell 7 features
(
-SkipCertificateCheckfor a self-signed server certificate and-Formfor multipart file upload). - Network reach to the Athena web port (default
8443; see Network Ports). - Roles. Creating, updating, deleting, uploading/removing files, building, and deploying require the Admin role. Listing, reading a package, and reading an execution require the Operator role (Operators and Admins). See Roles & Permissions.
Importing the module#
Import the module manifest, then sign in with Connect-AthenaServer. The session
(base URL and token) is stored in the module and reused automatically by every other cmdlet, so
you only authenticate once per shell.
Import-Module ./AthenaDeploymentPackages.psd1 -Force
# Sign in — the session is cached and reused by the other cmdlets
Connect-AthenaServer -BaseUrl https://athena.example.com:8443 -Username admin -Password '<your-password>'
# …or prompt for a credential instead of a plaintext password
Connect-AthenaServer -BaseUrl https://athena.example.com:8443 -Credential (Get-Credential)
Connect-AthenaServer defaults -BaseUrl to
https://localhost:8443 and trusts a self-signed certificate by default
(-SkipCertificateCheck $true). Against a server with a
trusted certificate, pass
-SkipCertificateCheck $false. Add -PassThru to return the session
object if you want to capture it and pass it explicitly with the common -Session
parameter.
Cmdlet reference#
Every cmdlet unwraps the standard response envelope and returns the payload directly, and throws a
terminating error if the server reports failure. Mutating cmdlets that delete data
(Remove-*) support -WhatIf and -Confirm.
| Cmdlet | What it does | Role |
|---|---|---|
Connect-AthenaServer | Authenticate and cache a session for the other cmdlets. | Any user |
New-AthenaDeploymentStep | Build one ordered step object (client-side helper — no server call). | — |
New-AthenaDeploymentPackage | Create a package with its steps. | Admin |
Get-AthenaDeploymentPackage | List packages (paged, optional search) or fetch one by -Id with steps and files. | Operator |
Set-AthenaDeploymentPackage | Update a package — pass the full desired name, folder, and steps. | Admin |
Remove-AthenaDeploymentPackage | Delete a package and its files. | Admin |
Add-AthenaDeploymentPackageFile | Upload a file into a package and rebuild the bundle. | Admin |
Get-AthenaDeploymentPackageFile | List the files in a package. | Operator |
Remove-AthenaDeploymentPackageFile | Remove a file from a package and rebuild the bundle. | Admin |
Invoke-AthenaDeploymentPackageBuild | Explicitly rebuild the package bundle. | Admin |
Start-AthenaDeploymentPackageDeploy | Deploy a package to targets, starting immediately unless scheduled. | Admin |
Get-AthenaDeploymentExecution | Get an execution's status, rollup counters, and per-agent results. | Operator |
Wait-AthenaDeploymentExecution | Poll an execution until it reaches a terminal state. | Operator |
Building steps#
New-AthenaDeploymentStep builds a single step for a package. It accepts friendly
names for -Type, -RunAs, and -OsCondition and translates
them to the values the API expects, so you don't have to remember any codes. Pass an array of the
objects it returns to New-AthenaDeploymentPackage -Steps or
Set-AthenaDeploymentPackage -Steps.
| Parameter | Meaning |
|---|---|
-Name (required) | Step title. |
-Order (required) | 1-based position in the sequence. |
-Type (required) | One of RunCommand, StopService, StartService, InstallApplication, CopyFiles, PowerShell, Batch, Shell, Uninstall, Wait, RestartService, Reboot, TriggerInventory. |
-Command / -Arguments | Command line and arguments for command/script steps. |
-FileName | An uploaded file the step references (for install/copy steps). |
-TargetDirectory / -WorkingDirectory | Destination for copies; working directory for commands. |
-ServiceName | Service for start/stop/restart steps. |
-RunAs | System (default), CurrentUser, or SpecificCredential. With the last, pass -CredentialId from the Credential Vault. |
-OsCondition | Restrict the step to a platform (e.g. Any, Windows10, Windows11, WindowsServer2019, Linux). Defaults to Any; also accepts an integer. |
-TimeoutSeconds | Per-step timeout. Defaults to 300. |
-SuccessExitCodes | Comma-separated codes treated as success. Defaults to 0 (e.g. "0,3010" to accept "reboot required"). |
-ConditionScript / -ConditionEnabled | A PowerShell expression gating the step, and a switch to enable it. |
-ContinueOnError | Keep running later steps even if this one fails. |
-WaitSeconds | Pause length for a Wait step. |
Files & rebuilding#
Steps such as InstallApplication and CopyFiles reference a file that must
first be uploaded to the package. Add-AthenaDeploymentPackageFile -Id <pkg>
-Path <file> uploads a file and rebuilds the bundle in one call;
Remove-AthenaDeploymentPackageFile removes one and rebuilds. Because upload and remove
both rebuild automatically, you rarely need Invoke-AthenaDeploymentPackageBuild — it
is there to force a rebuild on demand. A single file upload is capped at 1 GB.
Deploying & targeting#
Start-AthenaDeploymentPackageDeploy creates a deployment execution and — unless you
schedule it — starts it right away. You must give the execution a -Name and at least
one target; the targeting parameters can be combined:
| Parameter | Meaning |
|---|---|
-Id (required) | The package to deploy. |
-Name (required) | Name for this deployment execution. |
-TargetAgentId | One or more specific agents by GUID. |
-TargetTag | Every agent carrying a matching tag. |
-CollectionId | Every member of a collection. |
-ScheduledAt | A future time. When set, the execution is created in a Scheduled state and not started; when omitted, it starts immediately. |
-SkipCleanup | Leave the deployment files on the agent after the run (useful for debugging). The default is to clean up. |
A single -ScheduledAt runs a package once at a set time. For repeating rollouts,
drive the deploy from a scheduled job instead.
Monitoring executions#
Get-AthenaDeploymentExecution -ExecutionId <id> returns the execution's
rollup counters (totalAgents, completedAgents, failedAgents,
runningAgents, progressPercent), the current step, and a per-agent
breakdown with per-step results. Wait-AthenaDeploymentExecution polls it for you until
it reaches a terminal state, with tunable -TimeoutSeconds (default 300) and
-PollSeconds (default 5). The status is one of:
| Status | Meaning |
|---|---|
Pending | Created but not yet started. |
Scheduled | Waiting for its scheduled start time. |
Running | Executing on one or more agents. |
Completed | Finished successfully on all targets. |
Failed | Failed. |
Cancelled | Cancelled before completion. |
PartialSuccess | Finished, but some agents failed. |
Rejected | The agent was busy and declined the deployment. |
End-to-end example#
A complete create → upload → deploy → wait run that installs 7-Zip on every workstation-tagged agent and then refreshes inventory:
Import-Module ./AthenaDeploymentPackages.psd1 -Force
Connect-AthenaServer -BaseUrl https://athena.example.com:8443 -Username admin -Password '<your-password>'
# 1. Build the ordered steps (friendly enum names — no codes to remember)
$steps = @(
New-AthenaDeploymentStep -Name 'Install 7-Zip' -Order 1 -Type InstallApplication `
-FileName '7z2408-x64.msi' -Arguments '/qn /norestart' `
-SuccessExitCodes '0,3010' -OsCondition Windows11 -TimeoutSeconds 600
New-AthenaDeploymentStep -Name 'Refresh inventory' -Order 2 -Type TriggerInventory
)
# 2. Create the package, then upload the file the step references
# (uploading rebuilds the bundle automatically)
$pkg = New-AthenaDeploymentPackage -Name '7-Zip 24.08' -FolderName '7zip-2408' -Steps $steps
Add-AthenaDeploymentPackageFile -Id $pkg.id -Path '.\7z2408-x64.msi'
# 3. Deploy to a tag now, then wait for the result
$exec = Start-AthenaDeploymentPackageDeploy -Id $pkg.id -Name '7-Zip rollout' -TargetTag 'workstation'
$result = Wait-AthenaDeploymentExecution -ExecutionId $exec.id -Verbose
# 4. Inspect the per-agent, per-step outcome
$result.agentResults.stepResults | Select-Object stepName, exitCode, output, errorOutput
Prefer -Credential (Get-Credential) over an inline -Password so
credentials aren't stored in plaintext or shell history. For steps that must run as a specific
account, reference a stored vault credential by ID with
-RunAs SpecificCredential -CredentialId rather than embedding passwords in a
command.
For the full step field model see Deployment Package Steps; for the underlying HTTP calls see the API Reference; for how long a run may take before finalization see Deployment Timeouts.