The Add-WindowsCapability cmdlet is a powerful tool for Windows administrators to install roles, role services, and features on Windows 10, Windows 8.1, and Windows Server 2012 R2 and later versions. It is part of the Windows PowerShell module for Windows Management Framework (WMF) 5.0 and later. This cmdlet can be used to install a single role, role service, or feature, or to install multiple roles, role services, and features at once.
Syntax
The syntax for the Add-WindowsCapability cmdlet is as follows:
Add-WindowsCapability -Name
Parameters
The Add-WindowsCapability cmdlet has the following parameters:
Parameter | Description |
---|---|
Name | Specifies the name of the role, role service, or feature to install. |
Online | Specifies that the role, role service, or feature should be installed from the online Windows Update service. |
Source | Specifies the path to the source files for the role, role service, or feature. This parameter is only used when the Online parameter is not specified. |
LimitAccess | Specifies that the role, role service, or feature should be installed from a limited access source, such as a Windows Server Update Services (WSUS) server. |
Confirm | Prompts the user for confirmation before running the cmdlet. |
WhatIf | Shows what would happen if the cmdlet runs. |
LogPath | Specifies the path to the log file for the cmdlet. |
LogLevel | Specifies the log level for the cmdlet. Valid values are Verbose, Debug, Info, Warning, Error, and Critical. |
LogMaxSize | Specifies the maximum size of the log file in bytes. |
LogMaxHistory | Specifies the maximum number of log files to keep. |
LogMaxAge | Specifies the maximum age of the log file in days. |
Inputs
The Add-WindowsCapability cmdlet accepts the following input types:
- System.String
- System.Management.Automation.SwitchParameter
- System.Management.Automation.PSObject
Outputs
The Add-WindowsCapability cmdlet produces the following output types:
- System.Object
- System.Management.Automation.PSObject
Examples
The following examples show how to use the Add-WindowsCapability cmdlet:
To install the Telnet Client role service:
Add-WindowsCapability -Name TelnetClient
To install the Telnet Client role service from a local source:
Add-WindowsCapability -Name TelnetClient -Source C:\source\
To install the Telnet Client role service from a limited access source:
Add-WindowsCapability -Name TelnetClient -LimitAccess
Tips and Tricks
Here are some tips and tricks for using the Add-WindowsCapability cmdlet:
- Use the Online parameter to install roles, role services, and features from the online Windows Update service.
- Use the Source parameter to install roles, role services, and features from a local source.
- Use the LimitAccess parameter to install roles, role services, and features from a limited access source, such as a WSUS server.
- Use the LogPath, LogLevel, LogMaxSize, LogMaxHistory, and LogMaxAge parameters to specify the log file for the cmdlet.
- Use the Confirm and WhatIf parameters to verify the cmdlet before running it.
Introduction
The Add-WindowsCapability cmdlet is a powerful tool for Windows administrators to install roles, role services, and features on Windows 10, Windows 8.1, and Windows Server 2012 R2 and later versions. It is part of the Windows PowerShell module for Windows Management Framework (WMF) 5.0 and later. This cmdlet can be used to install a single role, role service, or feature, or to install multiple roles, role services, and features at once.
The Add-WindowsCapability cmdlet has several parameters that can be used to customize the installation process. It also has several output types that can be used to verify the installation. This article will provide an overview of the Add-WindowsCapability cmdlet, including syntax, parameters, inputs, outputs, examples, and tips.