william-r
12/11/2018 - 10:32 PM

Environmental Variables

# Replace target with the following options: ["Machine", "Process", "User"]
$target = "User"
$variableName = "NameOfVariable"
$variableValue = "ValueOfVariable"

[System.Environment]::SetEnvironmentVariable($variableName, $variableValue, [System.EnvironmentVariableTarget]::$target)
#[System.Environment]::SetEnvironmentVariable('NameOfVariable', 'ValueOfVariable', [System.EnvironmentVariableTarget]::$target)

Get-ChildItem Env:$variableName
#Get-ChildItem Env:NameOfVariable
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Bypass -Force