OneGet / MicrosoftDockerProvider

Provider to search, save and install Docker
Other
135 stars 56 forks source link

Installing Docker EE via DockerMSFTProvider doesn't work on Windows 10 #47

Closed tristanbarcelon closed 4 years ago

tristanbarcelon commented 5 years ago

When I attempt to install Docker EE on Windows 10 pro or workstation editions version 1803 using powershell cmdlet Install-Package Docker -ProviderName DockerMsftProvider -RequiredVersion "18.03.1-ee-2" -Force, I get the error: _Install-Package : The term 'Get-WindowsFeature' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1

I suspect this is caused by a bug on lines 588 and 603 where the switch statement on Win32_OperatingSystem.Caption returns something other than 'Microsoft Windows 10'. I'd like to suggest changing the OS detection scheme as follows:

1). Create a variable for capturing the OS caption.

[string] $OSCaption = Get-wmiobject -class win32_operatingsystem | select-object -ExpandProperty Caption

2). Change the switch statement on lines 587-588 and 602-603 as follows:

switch -Wildcard ($OSCaption) { 'Microsoft Windows 10*' { ..... } }

On my machine, Get-wmiobject -class win32_operatingsystem | select-object -ExpandProperty Caption returns Microsoft Windows 10 Pro for Workstations, while on a Windows Server 2016, the same cmdlet returns Microsoft Windows Server 2016 Standard. This should allow dockermsftprovider to get past the install package error.