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 50 forks source link

'Get-WindowsFeature' is not recognized as the name of a cmdlet #69

Closed james-powis closed 7 years ago

james-powis commented 7 years ago

When puppet runs it:

Failed to apply catalog: Execution of 'C:\Windows\system32\WindowsPowershell\v1.0\powershell.exe Get-WindowsFeature | ConvertTo-JSON' returned 1: The term 'Get-WindowsFeature' is not recognized as the name of a cmdlet, functi on, script file, or operable program. Check the spelling of the name, or if a p ath was included, verify that the path is correct and try again. At line:1 char:19 + Get-WindowsFeature <<<< | ConvertTo-JSON + CategoryInfo : ObjectNotFound: (Get-WindowsFeature:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException

When I run it:

PS C:\Users\vwadmin> Get-WindowsFeature
The term 'Get-WindowsFeature' is not recognized as the name of a cmdlet, function, script file, or operable program. Ch
eck the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:19
+ Get-WindowsFeature <<<<
    + CategoryInfo          : ObjectNotFound: (Get-WindowsFeature:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Puppet stuff:

PS C:\Users\vwadmin> puppet agent --version
4.5.2
PS C:\Users\vwadmin> facter --version
3.2.0 (commit 148948d795fbdcf6bcf51ed36a73f496775835dc)
PS C:\Users\vwadmin>
james-powis commented 7 years ago

Sorry, this is on 2008R2

james-powis commented 7 years ago

I have pinned it down to powershell modules not loading by default, one must explicitly import them by right clicking on powershell.

james-powis commented 7 years ago

OK i failed back to an older version of code and all is well, I suspect something in this commit is to blame: https://github.com/voxpupuli/puppet-windowsfeature/commit/660090607da66f8dac83a39fd1485bfa43764f5f I suspect around 23 green

james-powis commented 7 years ago

Most recent version addressed this specific issue