How to manage Windows Optional Features using command line and PowerShell

How to manage Windows Optional Features using command line and PowerShell

CHUONG K. NGUYEN – BSc., MCSEx2, MCSAx2, MCP, MCTS, MCITP, CCNA

Using Command Line

Launch CMD, type:

optionalfeatures

Press the Windows Key, type CMD, press CTRL+SHIFT+ENTER to launch command prompt in Administrative mode.

To list all features, type:

dism /online /get-features /format:table | more

List all enabled features:

dism /online /get-features /format:table | find “Enabled” | more

List all disabled features:

dism /online /get-features /format:table | find “Disabled” | more

List “Telnet” feature:

dism /online /get-features /format:table | find “Telnet” | more

To list details about the TelnetClient feature:

dism /online /get-featureinfo /featurename:TelnetClient

To enable TelnetClient feature:

dism /online /enable-feature /featurename:TelnetClient

Using PowerShell

Using PowerShell to list all enabled features:

get-windowsoptionalfeature -online | where state -like enabled* | ft | more

Or to show all features (enabled and disabled):

get-windowsoptionalfeature -online | ft | more

To show information about TelnetClient feature:

get-windowsoptionalfeature -online | where featurename -like *Telnet* | ft | more

To show information about TelnetClient feature:

get-windowsoptionalfeature -online -featurename *Telnet*

To disable TelnetClient feature:

disable-windowsoptionalfeature -online -featurename TelnetClient

To enable TelnetClient feature but you are unsure about the feature name, first, use get-windowsoptionalfeaturename and pipe it with the enable-windowsoptionalfeaturename commandlet.

get-windowsoptionalfeature -online -featurename *Telnet* | enable-windowsoptionalfeature -online -norestart

That’s it.