Use this command to see a list of all the variables available


Here is an example to get the machine variable


Here is an example to get two variables, Temp and User


In this example you can see how to connect to a computer to get a variable remotely

Invoke-Command -ComputerName $Target -ScriptBlock { $COMMAND } -Credential $USERNAME

Temp directory path for user Bob on remote machine

Invoke-Command -ComputerName "Computername" -ScriptBlock {[Environment]::GetEnvironmentVariable(“Temp”,”User”)} -Credential Bob


Get list of environment variables from Powershell