voxpupuli / puppet-windowsfeature

Library that uses ServerAdministration api that comes with Windows Server 2008 and Windows Server 2012 to add / remove windows features
https://forge.puppet.com/puppet/windowsfeature
MIT License
30 stars 49 forks source link

Errors during feature install on Windows 2019 #138

Closed Andy-Adrian closed 3 years ago

Andy-Adrian commented 3 years ago

Affected Puppet, Ruby, OS and module versions/distributions

How to reproduce (e.g Puppet code you use)

windowsfeature { 'AD-Domain-Services': ensure => present, installmanagementtools => true, }

What are you seeing

Feature AD-Domain-Services -IncludeManagementTools' returned 1: Install-WindowsFeature : Win32 internal error "Access is denied" 0x5 occurred while reading the console output buffer. Contact Microsoft Customer Support Services. At line:1 char:30

What behaviour did you expect instead

AD-DomainServices feature installed without error

Output log

Feature AD-Domain-Services -IncludeManagementTools' returned 1: Install-WindowsFeature : Win32 internal error "Access is denied" 0x5 occurred while reading the console output buffer. Contact Microsoft Customer Support Services. At line:1 char:30

Any additional information you'd like to impart

This is due to PowerShell attempting to display a progress bar to a non-interactive connection. Setting $ProgressPreference='SilentlyContinue' prior to the call to Install-WindowsFeature will resolve the problem. I suspect the same issue occurs during Uninstall-WindowsFeature as well, and that call will also need the progress bar to be bypassed.