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.

How this differs from the main module

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#

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.

CmdletWhat it doesRole
Connect-AthenaServerAuthenticate and cache a session for the other cmdlets.Any user
New-AthenaDeploymentStepBuild one ordered step object (client-side helper — no server call).—
New-AthenaDeploymentPackageCreate a package with its steps.Admin
Get-AthenaDeploymentPackageList packages (paged, optional search) or fetch one by -Id with steps and files.Operator
Set-AthenaDeploymentPackageUpdate a package — pass the full desired name, folder, and steps.Admin
Remove-AthenaDeploymentPackageDelete a package and its files.Admin
Add-AthenaDeploymentPackageFileUpload a file into a package and rebuild the bundle.Admin
Get-AthenaDeploymentPackageFileList the files in a package.Operator
Remove-AthenaDeploymentPackageFileRemove a file from a package and rebuild the bundle.Admin
Invoke-AthenaDeploymentPackageBuildExplicitly rebuild the package bundle.Admin
Start-AthenaDeploymentPackageDeployDeploy a package to targets, starting immediately unless scheduled.Admin
Get-AthenaDeploymentExecutionGet an execution's status, rollup counters, and per-agent results.Operator
Wait-AthenaDeploymentExecutionPoll 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.

ParameterMeaning
-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 / -ArgumentsCommand line and arguments for command/script steps.
-FileNameAn uploaded file the step references (for install/copy steps).
-TargetDirectory / -WorkingDirectoryDestination for copies; working directory for commands.
-ServiceNameService for start/stop/restart steps.
-RunAsSystem (default), CurrentUser, or SpecificCredential. With the last, pass -CredentialId from the Credential Vault.
-OsConditionRestrict the step to a platform (e.g. Any, Windows10, Windows11, WindowsServer2019, Linux). Defaults to Any; also accepts an integer.
-TimeoutSecondsPer-step timeout. Defaults to 300.
-SuccessExitCodesComma-separated codes treated as success. Defaults to 0 (e.g. "0,3010" to accept "reboot required").
-ConditionScript / -ConditionEnabledA PowerShell expression gating the step, and a switch to enable it.
-ContinueOnErrorKeep running later steps even if this one fails.
-WaitSecondsPause 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:

ParameterMeaning
-Id (required)The package to deploy.
-Name (required)Name for this deployment execution.
-TargetAgentIdOne or more specific agents by GUID.
-TargetTagEvery agent carrying a matching tag.
-CollectionIdEvery member of a collection.
-ScheduledAtA future time. When set, the execution is created in a Scheduled state and not started; when omitted, it starts immediately.
-SkipCleanupLeave the deployment files on the agent after the run (useful for debugging). The default is to clean up.
Recurring rollouts

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:

StatusMeaning
PendingCreated but not yet started.
ScheduledWaiting for its scheduled start time.
RunningExecuting on one or more agents.
CompletedFinished successfully on all targets.
FailedFailed.
CancelledCancelled before completion.
PartialSuccessFinished, but some agents failed.
RejectedThe 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
Keep secrets out of scripts

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.

Related pages

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.