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

Powershell error installing features #7

Closed lukesmith closed 10 years ago

lukesmith commented 10 years ago

I've just tried using this module and i'm encountering the following error when installing a feature

Where-Object : Cannot bind parameter 'FilterScript'. Cannot convert the "Instal
lState" value of type "System.String" to type "System.Management.Automation.Scr
iptBlock".
At line:1 char:74
+ Import-Module ServerManager; if((Get-WindowsFeature NET-Framework | where <<<
<  InstallState -eq 'Available').count-eq 0){ exit 1 }
    + CategoryInfo          : InvalidArgument: (:) [Where-Object], ParameterBi
   ndingException
    + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.PowerSh
   ell.Commands.WhereObjectCommand

The command it's failing on is, and is reproducible running manually

powershell.exe -ExecutionPolicy RemoteSigned -Command "Import-Module ServerManager; if((Get-WindowsFeature NET-Framework | where InstallState -eq 'Available').count-eq 0){ exit 1 }"

I've had a look to see what the issue is and found that the following works but I'm surprised this hasn't caused an issue for anyone else?

powershell.exe -ExecutionPolicy RemoteSigned -Command "Import-Module ServerManager; if((Get-WindowsFeature NET-Framework | where { $_.InstallState -eq 'Available' }).count-eq 0){ exit 1 }"
stack72 commented 10 years ago

MY apologies for thsi - it has been fixed in the latest version - i am just uploading this to the forge now. Version 0.1.2 is the package you want to cure this