In Windows 10 and from "Programs and Features", you can turn Windows features on or off and then initiate a download and installation. I wish to turn ".NET Framework 3.5" ON and have it downloaded and installed, but I need to do it via e.g. a PowerShell script or via a command. I need to use the command line.
How can this be achieved?
Here's how to turn on or off optional features on Windows 10 using Control Panel: Open Control Panel. Click on Programs. Click the Turn Windows features on or off link.
Enable or disable an optional feature You may use PowerShell commands to enable or disable optional features on a Windows 10 machine. The commands Enable-WindowsOptionalFeature -FeatureName and Disable-WindowsOptionalFeature -FeatureName are used for that.
Run a command prompt as an administrator and use:
dism /online /Get-Features
This will display the feature names since they don't always match up with what you're seeing in that visual feature list. It will also show which are currently enabled/disabled. Once you find the feature that you'd like to enable (NetFx3 in this case), run this:
dism /online /Enable-Feature /FeatureName:NetFx3
And as Richard stated, you can then disable a feature by simply switching "Enable" to "Disable" ex.
dism /online /Disable-Feature /FeatureName:NetFx3
Note: Sometimes a restart is required to see changes with windows features.
To enable and disable features on a client machine of Windows using PowerShell, the cmdlet you have to use is:
Enable-WindowsOptionalFeature
For example, with Windows 10 and NetFX 3, I would check if the feature is enabled with
Get-WindowsOptionalFeature -Online | Where-Object -FilterScript {$_.featurename -Like "*netfx3*"}
If not enabled, run this to enable it:
Enable-WindowsOptionalFeature -Online -FeatureName "NetFx3" -Source "SourcePath"
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