The Collection

A collection of useful information.

Filtering by Category: PowerShell

Initial Response...

Retrieving and setting Environment variables in Powershell.

Get:
.\ Get-ChildItem Env:
$Env:Temp

Set:
Process Level:
$Env:TEMP = "C:\Windows\Temp"

User/Machine Level:
[Environment]::SetEnvironmentVariable("Temp", "Test value.", "User")
Environment]::SetEnvironmentVariable("Temp", "Test value.", "Machine")

Delete:
[Environment]::SetEnvironmentVariable("Temp", $null, "User")