Use this command to see a list of all the variables available
[Environment]::GetEnvironmentVariables()
Here is an example to get the machine variable
[Environment]::GetEnvironmentVariables("Machine")
Here is an example to get two variables, Temp and User
[Environment]::GetEnvironmentVariable("Temp","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
Reference: