Skip to content

Commit 1c4185e

Browse files
Nibonsjayshah-msft
authored andcommitted
Windows 10 Support (OneGet#25)
* 'get-windowsfeature' -> get-windowsOptionalFeature for windows 10 * Added Win10 Uninstall methods
1 parent b81f886 commit 1c4185e

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

DockerMsftProvider.psm1

+16-3
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,13 @@ function InstallContainer
583583
}
584584
else
585585
{
586-
$containerExists = Get-WindowsFeature -Name Containers
586+
switch(Get-wmiobject -class win32_operatingsystem | select-object -ExpandProperty Caption ){
587+
'Microsoft Windows 10' {
588+
$containerExists = Get-WindowsOptionalFeature -Online -FeatureName Containers |
589+
Select-object -Property *,@{name='Installed';expression={$_.State -eq 'Enabled'}}
590+
}
591+
Default {$containerExists = Get-WindowsFeature -Name Containers}
592+
}
587593
if($containerExists -and $containerExists.Installed)
588594
{
589595
Write-Verbose "Containers feature is already installed. Skipping the install."
@@ -592,7 +598,10 @@ function InstallContainer
592598
else
593599
{
594600
Write-Verbose "Installing Containers..."
595-
$null = Install-WindowsFeature containers
601+
switch(Get-wmiobject -class win32_operatingsystem | select-object -ExpandProperty Caption ){
602+
'Microsoft Windows 10' {$null = Enable-WindowsOptionalFeature -FeatureName Containers}
603+
Default {$null = Install-WindowsFeature containers}
604+
}
596605
$script:restartRequired = $true
597606
}
598607
}
@@ -608,7 +617,11 @@ function UninstallContainer
608617
}
609618
else
610619
{
611-
$null = Uninstall-WindowsFeature containers
620+
switch(Get-wmiobject -class win32_operatingsystem | select-object -ExpandProperty Caption ){
621+
'Microsoft Windows 10' {$null = Disable-WindowsOptionalFeature -FeatureName Containers}
622+
Default {$null = Uninstall-WindowsFeature containers }
623+
}
624+
612625
}
613626
}
614627

0 commit comments

Comments
 (0)