Skip to content
  • There are no suggestions because the search field is empty.

Agent Environments

A reference for the environment variables available to Blueprints, for both the Service Agent and the User Agent contexts.

Built in Variables

Predefined Constants

There are several predefined constants available for use in Validators and Workers.

Predefined Variable

 

Variable Set To

 

Useful For

 

$CLOUDSET_NAME

Name of the ASSET as configured in the K12Panel Web UI. Example value could be “ADMIN-DESK-01”

Useful if you need a Worker script to know the Web UI name that has been configured for an ASSET in the cloud.

$CLOUDSET_CHECKEDOUTUSER

Email address of the USER that the asset is checked out to, or ““ if no user.

If you need a handle on the email address to do things like promote the user to admin (via a worker) or check to see if the currently-logged-in-user is the responsible party.

$VALIDATED_WORK_DONE

Internal and understood by Agent

Responding from a Validator

$VALIDATED_WORK_NEEDED

Internal and understood by Agent

Responding from a Validator

$VALIDATED_WORK_INDETERMINATE

Internal and understood by Agent

Responding from a Validator

$VALIDATED_RUN_ALWAYS

Internal and understood by Agent

Responding from a Validator

$BLUEPRINT_VERSION

Obtained from blueprint’s version field.

Manipulating downloaded file within blueprint

$BLUEPRINT_FILENAME

Obtained from blueprint’s filename field.

Verifying installed version against blueprint’s version within validator.

$BLUEPRINT_CHECKSUM

Obtained from blueprint’s checksum field name.

Undetermined but here for potential future use.

 

Agent Environments

The K12Panel Agent exposes a set of environment values you can use in Blueprints by referencing $env:VARIABLENAME. The exact values can differ from machine to machine depending on configuration.

There are two execution contexts, and several variables differ between them. The Service Agent runs in service (system) space, so user-profile paths point at the system profile. The User Agent runs in the logged-in user’s context, so those paths point at that user’s profile.

Service Agent Environment (selected variables)

User Agent Environment (selected variables)

Both contexts also expose the standard Path, PATHEXT, PSModulePath, PSExecutionPolicyPreference, and processor identifier/level/revision values.

Common Questions

How do I use an environment value in a Blueprint?
Reference it as $env:VARIABLENAME — for example $env:COMPUTERNAME.

Why do APPDATA and USERPROFILE differ between agents?
The Service Agent runs in system space (system profile paths); the User Agent runs in the logged-in user’s context (their profile paths).

What is USERNAME in the Service Agent?
The machine account, shown as MachineHostName$.

Can the values vary by machine?
Yes. They reflect each machine’s configuration, so treat the values above as typical, not guaranteed.