Skip to main content
Version: 4.1.x

Get-ADTEnvironmentVariable

SYNOPSIS

Gets the value of the specified environment variable.

SYNTAX

Get-ADTEnvironmentVariable [-Variable] <String> [[-Target] <EnvironmentVariableTarget>] [<CommonParameters>]

DESCRIPTION

This function gets the value of the specified environment variable.

EXAMPLES

EXAMPLE 1

Get-ADTEnvironmentVariable -Variable Path

Returns the value of the Path environment variable.

EXAMPLE 2

Get-ADTEnvironmentVariable -Variable Path -Target Machine

Returns the value of the Path environment variable for the machine.

PARAMETERS

-Variable

The variable to get.

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Target

The target of the variable to get. This can be the machine, user, or process.

Type: EnvironmentVariableTarget
Parameter Sets: (All)
Aliases:
Accepted values: Process, User, Machine

Required: False
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

None

You cannot pipe objects to this function.

OUTPUTS

System.String

This function returns the value of the specified environment variable.

NOTES

An active ADT session is NOT required to use this function.

Tags: psadt
Website: https://psappdeploytoolkit.com
Copyright: (C) 2025 PSAppDeployToolkit Team (Sean Lillis, Dan Cunningham, Muhammad Mashwani, Mitch Richters, Dan Gough).
License: https://opensource.org/license/lgpl-3-0

https://psappdeploytoolkit.com/docs/reference/functions/Get-ADTEnvironmentVariable