From 32db09b31b80e22c294b2602f3d688bdcbcfffac Mon Sep 17 00:00:00 2001 From: Lenard Fudala Date: Fri, 16 Feb 2018 09:10:04 -0600 Subject: [PATCH 1/2] Fix Windows 10 checks --- DockerMsftProvider.psm1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/DockerMsftProvider.psm1 b/DockerMsftProvider.psm1 index a4292f9..a55885b 100644 --- a/DockerMsftProvider.psm1 +++ b/DockerMsftProvider.psm1 @@ -584,7 +584,7 @@ function InstallContainer } else { - switch(Get-wmiobject -class win32_operatingsystem | select-object -ExpandProperty Caption ){ + switch -regex (get-wmiobject -class win32_operatingsystem | select-object -ExpandProperty Caption ){ 'Microsoft Windows 10' { $containerExists = Get-WindowsOptionalFeature -Online -FeatureName Containers | Select-object -Property *,@{name='Installed';expression={$_.State -eq 'Enabled'}} @@ -599,7 +599,7 @@ function InstallContainer else { Write-Verbose "Installing Containers..." - switch(Get-wmiobject -class win32_operatingsystem | select-object -ExpandProperty Caption ){ + switch -regex (get-wmiobject -class win32_operatingsystem | select-object -ExpandProperty Caption ){ 'Microsoft Windows 10' {$null = Enable-WindowsOptionalFeature -FeatureName Containers} Default {$null = Install-WindowsFeature containers} } @@ -618,7 +618,7 @@ function UninstallContainer } else { - switch(Get-wmiobject -class win32_operatingsystem | select-object -ExpandProperty Caption ){ + switch -regex (get-wmiobject -class win32_operatingsystem | select-object -ExpandProperty Caption ){ 'Microsoft Windows 10' {$null = Disable-WindowsOptionalFeature -FeatureName Containers} Default {$null = Uninstall-WindowsFeature containers } } From b242ccb8dbe111c330334b2dab37e6bae3cabfd2 Mon Sep 17 00:00:00 2001 From: Lenard Fudala Date: Fri, 16 Feb 2018 09:36:14 -0600 Subject: [PATCH 2/2] Move to get-ciminstance from get-wmiobject --- DockerMsftProvider.psm1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/DockerMsftProvider.psm1 b/DockerMsftProvider.psm1 index a55885b..d81c794 100644 --- a/DockerMsftProvider.psm1 +++ b/DockerMsftProvider.psm1 @@ -584,7 +584,7 @@ function InstallContainer } else { - switch -regex (get-wmiobject -class win32_operatingsystem | select-object -ExpandProperty Caption ){ + switch -regex (Get-CimInstance -ClassName Win32_OperatingSystem | select-object -ExpandProperty Caption ){ 'Microsoft Windows 10' { $containerExists = Get-WindowsOptionalFeature -Online -FeatureName Containers | Select-object -Property *,@{name='Installed';expression={$_.State -eq 'Enabled'}} @@ -599,7 +599,7 @@ function InstallContainer else { Write-Verbose "Installing Containers..." - switch -regex (get-wmiobject -class win32_operatingsystem | select-object -ExpandProperty Caption ){ + switch -regex (Get-CimInstance -ClassName Win32_OperatingSystem | select-object -ExpandProperty Caption ){ 'Microsoft Windows 10' {$null = Enable-WindowsOptionalFeature -FeatureName Containers} Default {$null = Install-WindowsFeature containers} } @@ -618,7 +618,7 @@ function UninstallContainer } else { - switch -regex (get-wmiobject -class win32_operatingsystem | select-object -ExpandProperty Caption ){ + switch -regex (Get-CimInstance -ClassName Win32_OperatingSystem | select-object -ExpandProperty Caption ){ 'Microsoft Windows 10' {$null = Disable-WindowsOptionalFeature -FeatureName Containers} Default {$null = Uninstall-WindowsFeature containers } }