title: How to enable a Windows feature via Powershell
body: <p>I need to enable two Windows Features using Powershell. But I don't know their names or how to find them.</p>
  
  <p><img src="https://i.stack.imgur.com/n7LJk.png" alt="Windows Features"></p>
  
  <p>So far I have managed to install the IIS and stop the Default Application Pool using a script found <a href="https://gist.github.com/1302170" rel="noreferrer">here</a>.</p>
  
  <pre><code>function InstallFeature($name) {
      cmd /c "ocsetup $name /passive"
  }
  InstallFeature IIS-WebServerRole
      InstallFeature IIS-WebServer
          InstallFeature IIS-CommonHttpFeatures
              InstallFeature IIS-DefaultDocument
              InstallFeature IIS-DirectoryBrowsing
              InstallFeature IIS-HttpErrors
              InstallFeature IIS-HttpRedirect
              InstallFeature IIS-StaticContent
          InstallFeature IIS-HealthAndDiagnostics
              InstallFeature IIS-CustomLogging
              InstallFeature IIS-HttpLogging
              InstallFeature IIS-HttpTracing
              InstallFeature IIS-LoggingLibraries
          InstallFeature IIS-Security
              InstallFeature IIS-RequestFiltering
              InstallFeature IIS-WindowsAuthentication
          InstallFeature IIS-ApplicationDevelopment
              InstallFeature IIS-NetFxExtensibility
              InstallFeature IIS-ISAPIExtensions
              InstallFeature IIS-ISAPIFilter
              InstallFeature IIS-ASPNET
      InstallFeature IIS-WebServerManagementTools 
          InstallFeature IIS-ManagementConsole 
          InstallFeature IIS-ManagementScriptingTools
  
  import-module WebAdministration
  
  Stop-WebAppPool DefaultAppPool
  </code></pre>
  
  <p><strong>Solution</strong></p>
  
  <p>To search:</p>
  
  <pre><code>Get-WindowsFeature *ASP*
  Get-WindowsFeature *activation*
  </code></pre>
  
  <p>To install:</p>
  
  <pre><code>Add-WindowsFeature NET-Framework-45-ASPNET
  Add-WindowsFeature NET-HTTP-Activation
  </code></pre>