Set-EnvVariable + minor fix to SystemName
This commit is contained in:
parent
25ec753675
commit
80a488484b
|
@ -18,6 +18,7 @@ class SystemName { #: System.Management.Automation.IValidateSetValuesGenerator {
|
||||||
}
|
}
|
||||||
$possibleValues.out = $possibleValues.out |
|
$possibleValues.out = $possibleValues.out |
|
||||||
Select-Object -Unique |
|
Select-Object -Unique |
|
||||||
|
Where-Object { $_ } |
|
||||||
Sort-Object {
|
Sort-Object {
|
||||||
$local:sortName = "zz_$_";
|
$local:sortName = "zz_$_";
|
||||||
if( $_ -in $possibleValues.Exist -and $_ -in $possibleValues.Current ) { $sortName[0] = "a" }
|
if( $_ -in $possibleValues.Exist -and $_ -in $possibleValues.Current ) { $sortName[0] = "a" }
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
[CmdletBinding()]param(
|
||||||
|
[string]$Name,
|
||||||
|
[object]$Value
|
||||||
|
)
|
||||||
|
|
||||||
|
Set-Item -Path (Join-Path "env:" $Name) -Value $Value
|
|
@ -0,0 +1,11 @@
|
||||||
|
[CmdletBinding()]param(
|
||||||
|
[string]$Name,
|
||||||
|
[object]$Value,
|
||||||
|
[ValidateSet('User','Machine')]
|
||||||
|
[string]$Persist
|
||||||
|
)
|
||||||
|
|
||||||
|
Set-Item -Path (Join-Path "env:" $Name) -Value $Value
|
||||||
|
if( $Persist ) {
|
||||||
|
[environment]::setEnvironmentVariable($Name, $Value, $Persist)
|
||||||
|
}
|
Loading…
Reference in New Issue