Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix InstallContainer error when using DockerMSFTProvider on Windows 10 #48

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DockerMsftProvider.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = 'DockerMsftProvider.psm1'

# Version number of this module.
ModuleVersion = '1.0.0.5'
ModuleVersion = '1.0.0.6'

# ID used to uniquely identify this module
GUID = '5beed3da-526b-47eb-9197-29c6a7214e4e'
Expand Down
16 changes: 9 additions & 7 deletions DockerMsftProvider.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -584,8 +584,9 @@ function InstallContainer
}
else
{
switch(Get-wmiobject -class win32_operatingsystem | select-object -ExpandProperty Caption ){
'Microsoft Windows 10' {
[string] $OSCaption = Get-wmiobject -class win32_operatingsystem | select-object -ExpandProperty Caption
switch -WildCard ($OSCaption) {
'Microsoft Windows 10*' {
$containerExists = Get-WindowsOptionalFeature -Online -FeatureName Containers |
Select-object -Property *,@{name='Installed';expression={$_.State -eq 'Enabled'}}
}
Expand All @@ -599,8 +600,8 @@ function InstallContainer
else
{
Write-Verbose "Installing Containers..."
switch(Get-wmiobject -class win32_operatingsystem | select-object -ExpandProperty Caption ){
'Microsoft Windows 10' {$null = Enable-WindowsOptionalFeature -FeatureName Containers}
switch -WildCard ($OSCaption) {
'Microsoft Windows 10*' {$null = Enable-WindowsOptionalFeature -FeatureName Containers}
Default {$null = Install-WindowsFeature containers}
}
$script:restartRequired = $true
Expand All @@ -618,9 +619,10 @@ function UninstallContainer
}
else
{
switch(Get-wmiobject -class win32_operatingsystem | select-object -ExpandProperty Caption ){
'Microsoft Windows 10' {$null = Disable-WindowsOptionalFeature -FeatureName Containers}
Default {$null = Uninstall-WindowsFeature containers }
[string] $OSCaption = Get-wmiobject -class win32_operatingsystem | select-object -ExpandProperty Caption
switch -WildCard ($OSCaption) {
'Microsoft Windows 10*' {$null = Disable-WindowsOptionalFeature -FeatureName Containers}
Default {$null = Uninstall-WindowsFeature containers}
}

}
Expand Down