mirror of
https://github.com/actions/runner-images.git
synced 2025-12-14 22:05:17 +00:00
* Use Resolve-GithubReleaseAssetUrl more widely * Add the Get-ChecksumFromUrl function * Sort exported functions and add docs * Remove alias and fix typo * Fix kind checksum url and syntax * Fix checksums url for gh cli and msys2 * [Windows] Cleanup various scripts * Add spaces after type specifications * Rename the Take-Part function
36 lines
1.4 KiB
PowerShell
36 lines
1.4 KiB
PowerShell
####################################################################################
|
|
## File: Install-WindowsFeatures.ps1
|
|
## Desc: Install Windows Features
|
|
####################################################################################
|
|
|
|
$windowsFeatures = (Get-ToolsetContent).windowsFeatures
|
|
|
|
foreach ($feature in $windowsFeatures) {
|
|
if ($feature.optionalFeature) {
|
|
Write-Host "Activating Windows Optional Feature '$($feature.name)'..."
|
|
Enable-WindowsOptionalFeature -Online -FeatureName $feature.name -NoRestart
|
|
|
|
$resultSuccess = $?
|
|
} else {
|
|
Write-Host "Activating Windows Feature '$($feature.name)'..."
|
|
$Arguments = @{
|
|
Name = $feature.name
|
|
IncludeAllSubFeature = [System.Convert]::ToBoolean($feature.includeAllSubFeatures)
|
|
IncludeManagementTools = [System.Convert]::ToBoolean($feature.includeManagementTools)
|
|
}
|
|
$result = Install-WindowsFeature @Arguments
|
|
|
|
$resultSuccess = $result.Success
|
|
}
|
|
|
|
if ($resultSuccess) {
|
|
Write-Host "Windows Feature '$($feature.name)' was activated successfully"
|
|
} else {
|
|
throw "Failed to activate Windows Feature '$($feature.name)'"
|
|
}
|
|
}
|
|
|
|
# it improves Android emulator launch on Windows Server
|
|
# https://learn.microsoft.com/en-us/windows-server/virtualization/hyper-v/manage/manage-hyper-v-scheduler-types
|
|
bcdedit /set hypervisorschedulertype root
|