Skip to main content

Get-PowerShellVariable

SYNOPSIS​

Will show env: and PowerShell variable active in session.

SYNTAX​

Get-PowerShellVariable [[-Name] <String[]>] [<CommonParameters>]

DESCRIPTION​

Gets environment variables and the active PowerShell variables in the current session and shows their values.

EXAMPLES​

EXAMPLE 1​

Get-PowerShellVariable

Runs Get-PowerShellVariable.

EXAMPLE 2​

Get-PowerShellVariable -Name ErrorActionPreference
Will show what the value is for $ErrorActionPreference.

EXAMPLE 3​

Get-PowerShellVariable -Name ErrorActionPreference,OneDriveConsumer
Will show what the value is for $ErrorActionPreference and $env:OneDriveConsumer.

PARAMETERS​

-Name​

To filter for a specific variable.

Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: 1
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​

OUTPUTS​

System.Management.Automation.PSCustomObject​

NOTES​

ALIASES​

None.

PLATFORM APPLICABILITY​

Windows, macOS, and Linux.

POWERSHELL COMPATIBILITY​

See PowerShell compatibility for the supported runtime policy. PowerShell 7.6 LTS is preferred.

https://docs.keldor.dev/powershell/keldor/Get-PowerShellVariable