mwrock / packer-templates

Templates for creating vagrant boxes
Other
536 stars 250 forks source link

Add a windows Feature on windows 2016 needs a source #53

Closed StefanSchoof closed 8 years ago

StefanSchoof commented 8 years ago

The installation of a windows feature ask for a source directory and is not able to download it from windows update. I tried using the gui and powershell with no success.

PS C:\Windows\system32> Add-WindowsFeature RSAT-DNS-Server
Add-WindowsFeature : The request to add or remove features on the specified server failed.
Installation of one or more roles, role services, or features failed.
The source files could not be found.
Use the "Source" option to specify the location of the files that are required to restore the feature. For more
information on specifying a source location, see http://go.microsoft.com/fwlink/?LinkId=243077. Error: 0x800f081f
At line:1 char:1
+ Add-WindowsFeature RSAT-DNS-Server
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (@{Vhd=; Credent...Name=localhost}:PSObject) [Install-WindowsFeature],
    Exception
    + FullyQualifiedErrorId : DISMAPI_Error__Failed_To_Enable_Updates,Microsoft.Windows.ServerManager.Commands.AddWind
   owsFeatureCommand

Success Restart Needed Exit Code      Feature Result
------- -------------- ---------      --------------
False   No             Failed         {}
mwrock commented 8 years ago

Yes. the template in this repo removes all unused features from disk so its best to first enable whatever features you think you need. The relevant code s at https://github.com/mwrock/packer-templates/blob/master/scripts/package.ps1#L10-L15

StefanSchoof commented 8 years ago

Thanks for the explanation.

I wonder why removing means unable to install without source. In the Windows2012R2 box the Add-WindowsFeature commands runs with success.

mwrock commented 8 years ago

Even on 2012R2 I have found that some features can be installed afterwards without issue and others require a source. I really dont know how to determine up front which features are affected but I soppose the list has changed between 2012R2 and 2016.

StefanSchoof commented 7 years ago

With TP5 I could install the AD-Domain-Services Feature with a source. In the RTM this always fails, other Features like RSAT-DNS-Server work with the same source (and no internet connection)

There is a Stack Overflow Question for this Issue (https://stackoverflow.com/questions/39469452/installing-removed-windows-features). Unsure the cause is something in the windows image from MS or in the box.