win_feature failing

I am trying to use win_feature on a Windows 2008 R2 Server and reviving the following error:

FAILED! => {“changed”: false, “failed”: true, “msg”: “Method invocation failed because [System.Management.Automation.PSCustomObject] doesn’t contain a method named ‘Remove’.”}

The server is running PowerShell 3.0. I tried updating this to 4.0 because win_feature is working on a 2012 Server, but this didn’t resolve the problem.

Thanks in advance!!

Here is the playbook entry:

  • name: Install IIS Windows 2007
    win_feature:
    name: “AS-AppServer-Ext,AS-MSMQ-Activation,AS-TCP-Activation,AS-Named-Pipes,FS-FileServer,Web-St
    atic-Content,Web-Default-Doc,Web-Dir-Browsing,Web-Http-Errors,Web-Http-Redirect,Web-Asp-Net,Web-Net-
    Ext,Web-ASP,Web-CGI,Web-ISAPI-Ext,Web-ISAPI-Filter,Web-Includes,Web-Http-Logging,Web-Log-Libraries,W
    eb-Request-Monitor,Web-Http-Tracing,Web-Basic-Auth,Web-Windows-Auth,Web-Digest-Auth,Web-Client-Auth,
    Web-Cert-Auth,Web-Url-Auth,Web-Filtering,Web-IP-Security,Web-Mgmt-Console,Web-Scripting-Tools,Web-Mg
    mt-Service,Web-Metabase,Web-WMI,Web-Lgcy-Scripting,Web-Lgcy-Mgmt-Console,NET-Framework-Core,NET-HTTP
    -Activation,NET-Non-HTTP-Activ,MSMQ-Server,RSAT-Web-Server,PowerShell-ISE,WAS-Process-Model,WAS-NET-
    Environment,WAS-Config-APIs”
    state: present
    include_management_tools: yes

Also, the error only happens on state=present. state=absent works fine.

Hi Justin,
Just to confirm: Its working on server 2012 but not on 208R2 (regardless of PS version), is that right? I have to admit I use 2012R2 for testing, so there might be bugs like this slipping thru. Please confirm, and I’ll try and have a look at this asap.

Yes, it's working in 2012,but not 2008r2.