# encoding: ascii
# api: powershell
# title: whitebox
# description: It gets the System Environment Variables from Registry
# version: 0.1
# author: BSonPosh
# license: CC0
# x-poshcode-id: 6437
# x-archived: 2016-10-15T17:06:42
# x-published: 2016-07-01T11:32:00
#
#
Param($srv=$env:ComputerName)
$regKey = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey([Microsoft.Win32.RegistryHive]::LocalMachine,$Srv)
$key = $regKey.OpenSubkey("SYSTEM\CurrentControlSet\Control\Session Manager\Environment",$false)
$key.GetValueNames() | Select-Object @{n="ValueName";e={$_}},@{n="Value";e={$key.GetValue($_)}}