mirror of
https://github.com/actions/runner-images.git
synced 2025-12-18 15:57:17 +00:00
Merge pull request #925 from xtqqczze/replace-wmi-cmdlets
Replace use of deprecated WMI v1 cmdlets
This commit is contained in:
@@ -377,7 +377,7 @@ function Get-ToolsByName {
|
|||||||
|
|
||||||
function Get-WinVersion
|
function Get-WinVersion
|
||||||
{
|
{
|
||||||
(Get-WmiObject -class Win32_OperatingSystem).Caption
|
(Get-CimInstance -ClassName Win32_OperatingSystem).Caption
|
||||||
}
|
}
|
||||||
|
|
||||||
function Test-IsWin19
|
function Test-IsWin19
|
||||||
|
|||||||
@@ -8,7 +8,8 @@
|
|||||||
Write-Host "Install Containers feature"
|
Write-Host "Install Containers feature"
|
||||||
Install-WindowsFeature -Name Containers
|
Install-WindowsFeature -Name Containers
|
||||||
|
|
||||||
if ((GWMI Win32_Processor).VirtualizationFirmwareEnabled[0] -and (GWMI Win32_Processor).SecondLevelAddressTranslationExtensions[0]) {
|
$cpu = (Get-CimInstance -ClassName Win32_Processor)[0]
|
||||||
|
if ($cpu.VirtualizationFirmwareEnabled -and $cpu.SecondLevelAddressTranslationExtensions) {
|
||||||
Write-Host "Install Hyper-V feature"
|
Write-Host "Install Hyper-V feature"
|
||||||
Install-WindowsFeature -Name Hyper-V -IncludeManagementTools
|
Install-WindowsFeature -Name Hyper-V -IncludeManagementTools
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ Import-Module -Name ImageHelpers -Force
|
|||||||
|
|
||||||
function Get-WDKVersion
|
function Get-WDKVersion
|
||||||
{
|
{
|
||||||
$WDKVersion = (Get-WmiObject Win32_Product -Filter "Name = 'Windows Driver Kit'").version
|
$WDKVersion = (Get-CimInstance -ClassName Win32_Product -Filter "Name = 'Windows Driver Kit'").Version
|
||||||
|
|
||||||
if (!$WDKVersion)
|
if (!$WDKVersion)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user