Meta
Categories
Category Archives: PowerShell
Powershell Example: Environment Variables
Function GetEnvVar{ param( [Parameter(Mandatory=$true)][String]$varname ) $val = [System.Environment]::GetEnvironmentVariable(“$varname”, “Machine”) if (!$val){ Log “$varname env variable not found!” return “” } Log “$varname env variable found: $val” return $val } Function SetEnvVar{ param( [Parameter(Mandatory=$false)][String]$envname, [Parameter(Mandatory=$false)][String]$envval ) $beforeval = GetEnvVar $envname Log … Continue reading
Posted in PowerShell
Comments Off on Powershell Example: Environment Variables