Merge pull request #925 from xtqqczze/replace-wmi-cmdlets

Replace use of deprecated WMI v1 cmdlets
This commit is contained in:
Alejandro Pauly
2020-05-27 23:28:15 -04:00
committed by GitHub
3 changed files with 4 additions and 3 deletions

View File

@@ -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

View File

@@ -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 {

View File

@@ -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)
{ {