Skip to main content
Version: 4.0

Variables

When you open an ADTSession (which is done for you automatically in Invoke-AppDeployToolkit.ps1), a number of helpful variables are created, ranging from hardware information such as processor architecture and operating system name, system and user paths such as the Program Data folder, and Users' Home Drive, Active Directory Domain details etc.

These variables can also be instantiated without opening a session by calling the Export-ADTEnvironmentTableToSessionState command.

Variables specific to a particular deployment, such as $appName and $appVersion, have now been moved inside of the ADTSession object. For more information, see the ADTSession Object page.

Toolkit Name

VariableDescription
$appDeployMainScriptFriendlyNameFull name of toolkit including spaces
$appDeployToolkitNameShort-name of toolkit without spaces

Script Info

VariableDescription
$appDeployMainScriptVersionVersion number of the PSAppDeployToolkit

Culture

VariableDescription
$cultureObject which contains all of the current Windows culture settings
$currentLanguageCurrent Windows two letter ISO language name (e.g. EN, FR, DE, JA etc)
$currentUILanguageCurrent Windows two letter UI ISO language name (e.g. EN, FR, DE, JA etc)

Environment Variables

VariableDescription
$envAllUsersProfile%ALLUSERSPROFILE%, e.g. C:\ProgramData
$envAppData%APPDATA%, e.g. C:\Users\%USERNAME%\AppData\Roaming
$envArchitecture%PROCESSOR_ARCHITECTURE%, e.g. AMD64/IA64/x86.
Note - This doesn't tell you the architecture of the processor but only of the current process, so it returns "x86" for a 32-bit WOW process running on 64-bit Windows.
$envCommonDesktope.g. C:\Users\Public\Desktop
$envCommonDocumentse.g. C:\Users\Public\Documents
$envCommonProgramFiles%COMMONPROGRAMFILES%, e.g. C:\Program Files\Common Files)
$envCommonProgramFilesX86%COMMONPROGRAMFILES(x86)%, e.g. C:\Program Files (x86)\Common Files
$envCommonStartMenue.g. C:\ProgramData\Microsoft\Windows\Start Menu
$envCommonStartMenuProgramse.g. C:\ProgramData\Microsoft\Windows\Start Menu\Programs
$envCommonStartUpe.g. C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup
$envCommonTemplatese.g. C:\ProgramData\Microsoft\Windows\Templates
$envComputerName$COMPUTERNAME%, e.g. Computer1
$envComputerNameFQDNFully qualified computer name, e.g. computer1.contoso.com
$envHomeDrive%HOMEDRIVE%, e.g. C:
$envHomePath%HOMEPATH%, e.g. C:\Users\%USERNAME%
$envHomeShare%HOMESHARE% (Used instead of HOMEDRIVE if the home folder uses UNC paths.)
$envLocalAppData%LOCALAPPDATA%, e.g. C:\Users\%USERNAME%\AppData\Local
$envLogicalDrivesAn array containing all of the logical drives on the system.
$envProgramData%PROGRAMDATA%, e.g. C:\ProgramData
$envProgramFiles%PROGRAMFILES%, e.g. C:\Program Files
$envProgramFilesX86%ProgramFiles(x86)%, e.g. C:\Program Files (x86) (Only on 64 bit. Used to store 32 bit apps.)
$envPublic%PUBLIC%, e.g. C:\Users\Public
$envSystem32DirectoryC:\WINDOWS\system32
$envSystemDrive%SYSTEMDRIVE%, e.g. C:
$envSystemRAMSystem RAM as an integer
$envSystemRoot%SYSTEMROOT%, e.g. C:\Windows
$envTempChecks for the existence of environment variables in the following order and uses the first path found:
- The path specified by TEMP environment variable, (e.g. C:\Users\%USERNAME%\AppData\Local\Temp).
- The path specified by the USERPROFILE environment variable.
- The Windows root (C:\Windows) folder.
$envUserCookiesC:\Users\%USERNAME%\AppData\Local\Microsoft\Windows\INetCookies
$envUserDesktopC:\Users\%USERNAME%\Desktop
$envUserFavoritesC:\Users\%USERNAME%\Favorites
$envUserInternetCacheC:\Users\%USERNAME%\AppData\Local\Microsoft\Windows\INetCache
$envUserInternetHistoryC:\Users\%USERNAME%\AppData\Local\Microsoft\Windows\History
$envUserMyDocumentsC:\Users\%USERNAME%\Documents
$envUserName%USERNAME%
$envUserProfile%USERPROFILE%, e.g. %SystemDrive%\Users\%USERNAME%
$envUserSendToC:\Users\%USERNAME%\AppData\Roaming\Microsoft\Windows\SendTo
$envUserStartMenuC:\Users\%USERNAME%\AppData\Roaming\Microsoft\Windows\Start Menu
$envUserStartMenuProgramsC:\Users\%USERNAME%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs
$envUserStartUpC:\Users\%USERNAME%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
$envWinDir%WINDIR%, e.g. C:\Windows

Domain Membership

VariableDescription
$envLogonServerFQDN of %LOGONSERVER% used for authenticating logged in user
$envMachineADDomainRoot AD domain name for machine, e.g. domain.contoso.com
$envMachineDNSDomainFull Domain name for machine, e.g. <name>.contoso.com
$envMachineWorkgroupIf machine not joined to domain, what is the WORKGROUP it belongs to?
$envUserDNSDomain%USERDNSDOMAIN%. Root AD domain name for user, e.g. domain.contoso.com
$envUserDomain%USERDOMAIN%, e.g. domain.contoso.com
$IsMachinePartOfDomainIs machine joined to a domain, e.g. $true/$false
$MachineDomainControllerFQDN of an AD domain controller used for authentication

Operating System

VariableDescription
$envOSObject that contains details about the operating system
$envOSArchitectureRepresents the OS architecture (e.g. 32-Bit/64-Bit)
$envOSNameName of the operating system (e.g. Microsoft Windows 8.1 Pro)
$envOSProductTypeOS product type represented as an integer (e.g. 1/2/3)
$envOSProductTypeNameOS product type name (e.g. Server/Domain Controller/Workstation/Unknown)
$envOSServicePackLatest service pack installed on the system (e.g. Service Pack 3)
$envOSVersionFull version number of the OS (e.g. <major>.<minor>.<build>.<revision>)
$envOSVersionBuildBuild portion of the OS version number (e.g. <major>.<minor>.<build>.<revision>)
$envOSVersionMajorMajor portion of the OS version number (e.g. <major>.<minor>.<build>.<revision>)
$envOSVersionMinorMinor portion of the OS version number (e.g. <major>.<minor>.<build>.<revision>)
$envOSVersionRevisionRevision portion of the OS version number (e.g. <major>.<minor>.<build>.<revision>)
$Is64BitIs this a 64-bit OS? (e.g. $true/$false)
$IsDomainControllerOSIs domain controller OS? (e.g. $true/$false)
$IsServerOSIs server OS? (e.g. $true/$false)
$IsWorkStationOSIs workstation OS? (e.g. $true/$false)

Current Process Architecture

VariableDescription
$Is64BitProcessIs the current process 64-bits? (e.g. $true/$false)
$psArchitectureRepresents the current process architecture (e.g. x86/x64)

PowerShell And CLR (.NET) Versions

VariableDescription
$envCLRVersionFull version number of .NET used by PS (e.g. <major>.<minor>.<build>.<revision>)
$envCLRVersionBuildBuild portion of PS .NET version number (e.g. <major>.<minor>.<build>.<revision>)
$envCLRVersionMajorMajor portion of PS .NET version number (e.g. <major>.<minor>.<build>.<revision>)
$envCLRVersionMinorMinor portion of PS .NET version number (e.g. <major>.<minor>.<build>.<revision>)
$envCLRVersionRevisionRevision portion of PS .NET version number (e.g. <major>.<minor>.<build>.<revision>)
$envHostObject that contains details about the current PowerShell console
$envPSVersionFull version number of PS (e.g. <major>.<minor>.<build>.<revision>)
$envPSVersionBuildBuild portion of PS version number (e.g. <major>.<minor>.<build>.<revision>)
$envPSVersionMajorMajor portion of PS version number (e.g. <major>.<minor>.<build>.<revision>)
$envPSVersionMinorMinor portion of PS version number (e.g. <major>.<minor>.<build>.<revision>)
$envPSVersionRevisionRevision portion of PS version number (e.g. <major>.<minor>.<build>.<revision>)
$envPSVersionTableObject containing PowerShell version details from PS variable $PSVersionTable

Permissions / Accounts

VariableDescription
$CurrentProcessSIDObject that represents the current process account SID (e.g. S-1-5-32-544)
$CurrentProcessTokenObject that represents the current processes Windows Identity user token. Contains all details regarding user permissions.
$IsAdminIs the current process running with elevated admin privileges? (e.g. $true/$false)
$IsLocalServiceAccountIs the current process running under LOCAL SERVICE account? (e.g. $true/$false)
$IsLocalSystemAccountIs the current process running under the SYSTEM account? (e.g. $true/$false)
$IsNetworkServiceAccountIs the current process running under the NETWORK SERVICE account? (e.g. $true/$false)
$IsProcessUserInteractiveIs the current process able to display a user interface?
$IsServiceAccountIs the current process running as a service? (e.g. $true/$false)
$LocalSystemNTAccountLocalized NT account name of the SYSTEM account (e.g. NT AUTHORITY\SYSTEM)
$ProcessNTAccountCurrent process NT Account (e.g. NT AUTHORITY\SYSTEM)
$ProcessNTAccountSIDCurrent process account SID (e.g. S-1-5-32-544)
$SessionZeroIs the current process currently in session zero? In session zero isolation, process is not able to display a user interface. (e.g. $true/$false)

RegEx Patterns

VariableDescription
$MSIProductCodeRegExPatternContains the regex pattern used to detect a MSI product code

COM Objects

VariableDescription
$ShellRepresents and allows use of the WScript.Shell COM object
$ShellAppRepresents and allows use of the Shell.Application COM object

Logged On Users

VariableDescription
$CurrentConsoleUserSessionObjects that contains the account and session details of the console user (user with control of the physical monitor, keyboard, and mouse). This is the object from $LoggedOnUserSessions where the IsConsoleSession property is $true.
$CurrentLoggedOnUserSessionObject that contains account and session details for the current process if it is running as a logged in user. This is the object from $LoggedOnUserSessions where the IsCurrentSession property is $true.
$LoggedOnUserSessionsObject that contains account and session details for all users
$RunAsActiveUserThe active console user. If no console user exists but users are logged in, such as on terminal servers, then the first logged-in non-console user.
$UsersLoggedOnArray that contains all of the NTAccount names of logged in users

Microsoft Office

VariableDescription
envOfficeBitnessArchitecture of current Office installation, e.g. x86 or x64
envOfficeChannelCurrent Office Channel, e.g. 'Monthly Enterprise'
envOfficeVarsProperties of HKLM\SOFTWARE\Microsoft\Office\ClickToRun\Configuration
envOfficeVersionMicrosoft Office version, e.g. 16.0.x.x

Miscellaneous

VariableDescription
$invalidFileNameCharsArray of all invalid file name characters used to sanitize variables which may be used to create file names.
$LocalAdministratorsGroupReturns the name of the local Administrators group, typically BUILTIN\Administrators
$LocalUsersGroupReturns the name of the local Users group, typically BUILTIN\Users
$RunningTaskSequenceIs the current process running in a SCCM task sequence? (e.g. $true / $false)