Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade

How to Install Windows Features Using PowerShell\'s Install-WindowsFeature

The Install-WindowsFeature cmdlet is a powerful tool available in Windows Server environments that allows you to add roles and features to your Windows Server installation. This command is particularly useful for system administrators who need to automate the deployment of server roles and features across multiple servers.

Understanding Install-WindowsFeature

The Install-WindowsFeature cmdlet is a part of Windows PowerShell, which provides a command-line interface for managing Windows Server. It allows you to install server roles, role services, and features on local or remote servers. This cmdlet is available in Windows Server 2008 R2 and later versions.

Examples

Example 1: Installing a Feature on a Local Server

To install a feature on a local server, you can use the following PowerShell command. For instance, to install the Web Server (IIS) role, you would use:

Install-WindowsFeature -Name Web-Server

This command will install the Web Server (IIS) role on your local server.

Example 2: Installing a Feature on a Remote Server

To install a feature on a remote server, you need to specify the -ComputerName parameter. For example, to install the DHCP Server role on a remote server named "Server01", you would use:

Install-WindowsFeature -Name DHCP -ComputerName Server01

This command will install the DHCP Server role on the specified remote server.

Example 3: Installing Multiple Features

You can also install multiple features at once by specifying their names in a comma-separated list. For example, to install both the Web Server (IIS) and the DNS Server roles, you would use:

Install-WindowsFeature -Name Web-Server, DNS

Example 4: Including Management Tools

When installing a feature, you might also want to include management tools. You can do this by adding the -IncludeManagementTools parameter. For example:

Install-WindowsFeature -Name Web-Server -IncludeManagementTools

This command will install the Web Server (IIS) role along with its management tools.

Checking Installed Features

To verify which features are installed on your server, you can use the Get-WindowsFeature cmdlet:

Get-WindowsFeature

This command will display a list of all roles and features, indicating which ones are installed.

Alternatives in Non-Windows Server Environments

If you are working in a non-Windows Server environment, such as Windows 10 or Windows 11, the Install-WindowsFeature cmdlet is not applicable. Instead, you can use the DISM (Deployment Image Servicing and Management) tool to manage Windows features. For example:

DISM /Online /Enable-Feature /FeatureName:NetFx3

This command enables the .NET Framework 3.5 feature on a Windows client machine.

To share Download PDF

Gostou do artigo? Deixe sua avaliação!
Sua opinião é muito importante para nós. Clique em um dos botões abaixo para nos dizer o que achou deste conteúdo.