Closed mfann-or closed 1 year ago
This shouldn't be needed as far as I know. PowerShell should know that Get-WindowsFeature
is part of the ServerManager
module and just autoload it for you. The fact this isn't happening is puzzling and needs to be figured out to either avoid the problem with this scenario for other modules. Are you saying this happens on only certain hosts but others are fine? Are there any differences/similarities with the hosts that do not work compared to the ones that do? How are you connecting to the hosts, is it through ssh/winrm/psrp/something else? What happens when you run Get-WindowsFeature
on a brand new process on the server, does it also fail?
Agreed @jborean93 . After looking into this a bit further, I believe it is an internal problem with some of our instances. I'll go ahead and close this issue. Thanks for your time!
SUMMARY
The ServerManager PowerShell module doesn't always import automatically. Causing the
Get-WindowsFeature
cmdlet to not be found.ISSUE TYPE
COMPONENT NAME
community.windows.win_feature_info
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
Controller: awx-ee Target: Windows Server 2019
STEPS TO REPRODUCE
Not all machines successfully load the ServerManager PowerShell Module automatically. This causes the
Get-WindowsFeature
cmdlet to not be found and fail.EXPECTED RESULTS
Successfully return info about the Windows Feature
ACTUAL RESULTS
POSSIBLE SOLUTION
This issue can be fixed by explicitly importing the ServerManager module in
win_feature_info.ps1
. Shown here w/ a try/catch block.