mirror of
https://github.com/actions/runner-images.git
synced 2025-12-16 06:40:32 +00:00
[Windows] Set WSLv1 version on Windows Server 2022 (#5762)
* Set WSLv1 version on Windows Server 2022 * Create path if missing
This commit is contained in:
committed by
GitHub
parent
a58f12fe95
commit
e42b607790
@@ -75,7 +75,7 @@ function Set-DefaultVariable {
|
||||
|
||||
$key = [Microsoft.Win32.Registry]::LocalMachine.OpenSubKey($Name, $Writable)
|
||||
$key.SetValue($DefaultVariable, $Value, $Kind)
|
||||
Get-DefaultVariable $DefaultVariable
|
||||
Get-DefaultVariable -DefaultVariable $DefaultVariable -Name $Name
|
||||
$key.Handle.Close()
|
||||
[System.GC]::Collect()
|
||||
}
|
||||
@@ -135,6 +135,25 @@ function Add-DefaultPathItem {
|
||||
Disconnect-Hive
|
||||
}
|
||||
|
||||
function Add-DefaultItem {
|
||||
param(
|
||||
[string]$DefaultVariable,
|
||||
[string]$Value,
|
||||
[string]$Name = "DEFAULT\Environment",
|
||||
[string]$Kind = "ExpandString",
|
||||
[bool]$Writable = $true
|
||||
)
|
||||
|
||||
Connect-Hive
|
||||
$regPath = Join-Path "HKLM:\" $Name
|
||||
if (-not (Test-Path $Name)) {
|
||||
Write-Host "Creating $regPath key"
|
||||
New-Item -Path $regPath -Force | Out-Null
|
||||
}
|
||||
Set-DefaultVariable -DefaultVariable $DefaultVariable -Value $Value -Name $Name -Kind $Kind -Writable $Writable
|
||||
Disconnect-Hive
|
||||
}
|
||||
|
||||
function New-ItemPath {
|
||||
param (
|
||||
[string]$Path
|
||||
|
||||
Reference in New Issue
Block a user