ADTSession Object
The ADTSession
object is a core component of PSAppDeployToolkit, managing the state and information throughout a deployment session. It gathers essential details about the deployment environment and provides convenient properties and methods for use in scripts.
Initialization
When you start a deployment script, initialize the ADTSession
with the Open-ADTSession
function:
$adtSession = Open-ADTSession -AppName "YourAppName" -AppVersion "1.0.0" -AppVendor "YourVendor" -DeploymentType "Install" -SessionState $ExecutionContext.SessionState -PassThru
This initializes the session and gathers information about the deployment, user, and computer, providing an object with several helpful properties you can use.
In addition, opening a session creates additional variables in your PowerShell environment that are independent of any particular deployment. More information about these variables can be found in the Variables page.
Properties
The ADTSession object exposes several properties, which can be accessed using $adtSession.<PropertyName>
, e.g $adtSession.AppName
.
Deployment Information
Property | Description |
---|---|
AppArch | The architecture (e.g., x86, x64) of the application. |
AppLang | The language or locale of the application. |
AppName | The name of the application being deployed. |
AppRevision | The revision number of the application. |
AppVendor | The vendor of the application. |
AppVersion | The version of the application. |
DeploymentType | Indicates if the deployment is an "Install" or "Uninstall". |
DeploymentTypeName | The friendly name of the deployment type. |
DeployMode | The mode in which the deployment is running (e.g., "Interactive", "Silent"). |
Script Information
Property | Description |
---|---|
AppScriptAuthor | The author of the deployment script. |
AppScriptDate | The creation date of the deployment script. |
AppScriptVersion | The version of the deployment script. |
DeployAppScriptFriendlyName | The filename of the deployment script. |
DeployAppScriptParameters | The parameters passed to the deployment script. |
DeployAppScriptVersion | The version of PSAppDeployToolkit the deployment script originated from. |
Path Information
Property | Description |
---|---|
DirFiles | Path to the "Files" directory used by the toolkit. |
DirSupportFiles | Path to the "SupportFiles" directory used by the toolkit. |
ScriptDirectory | The directory where the deployment script is located. |
Logging Information
Property | Description |
---|---|
LogName | The name of the log file. |
LogTempFolder | The temporary folder where logs are stored. |
DisableLogging | Indicates if logging is disabled (True or False ). |
Date and Time Information
Property | Description |
---|---|
CurrentDate | The current date. |
CurrentDateTime | The current date and time. |
CurrentTime | The current time. |
Installation Information
Property | Description |
---|---|
AllowRebootPassThru | Indicates if reboot requests from the installer should be passed through to the system. |
DefaultMsiFile | The default MSI file used for installation if none is specified. |
DefaultMspFiles | The default MSP files used for installation if none are specified. |
DefaultMstFile | The default MST file used for installation if none are specified. |
InstallName | The name assigned to the installation. |
InstallPhase | The current phase of the installation process (e.g., "Pre-Installation", "Installation", "Post-Installation"). |
InstallTitle | The title displayed during installation. |
UseDefaultMsi | Indicates whether to use the default MSI file (True or False ). |
System Information
Property | Description |
---|---|