I need to enable two Windows Features using Powershell. But I don't know their names or how to find them.

So far I have managed to install the IIS and stop the Default Application Pool using a script found here.
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   Solution
To search:
Get-WindowsFeature *ASP* Get-WindowsFeature *activation*   To install:
Add-WindowsFeature NET-Framework-45-ASPNET Add-WindowsFeature NET-HTTP-Activation 
                1. Type Start PowerShell in the Command Prompt window to start Windows PowerShell. 2. Type Install-WindowsFeature WAS and press Enter to install the Windows Process Activation Service.
For newer Windows client OS (Windows 10/8.1/8) you cannot use Install-WindowsFeature as that is only for managing features on servers. Trying to use it will cause an error message:
Get-WindowsFeature : The target of the specified cmdlet cannot be a Windows client-based operating system.
There is a DISM Powershell module that you can use to find and install optional features:
gcm -module DISM #List available commands Get-WindowsOptionalFeature -online | ft #List all features and status Enable-WindowsOptionalFeature -online -FeatureName NetFx3 -Source e:\Sources\sxs   In the last command -Source e:\Sources\sxs is only required if the feature needs to reference the installation media for source files (usually to fix Error: 0x800f081f The source files could not be found). The .NET Framework version 3.5 seems to be the only one that requires that for the client OS, but there are many others on the Server OS that require referencing the installation media for sources.
if you are in windows 2008R2 there is a module for this :
Import-Module servermanager
this module exports 3 cmdlets : Get-WindowsFeature, Add-WindowsFeature and remove-WindowsFeature
so you can make someting like get-windowsfeature *frame* to list the .net features and install it via command like  Add-WindowsFeature Net-Framework
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With