How to enable / disable the Windows feature from the command line in Windows 10?

In Windows 10 and in the "Programs and Features" section, you can enable or disable Windows features, and then start the download and installation. I want to enable ".NET Framework 3.5" and download and install it, but I need to do this, for example, using a PowerShell script or using a command. I need to use the command line.

How to achieve this?

Enter image description here

+12
source share
3 answers

Run the command line as administrator and use:

dism /online /Get-Features 

This will display the function names as they do not always match what you see in this list of visual functions. It will also show which ones are currently enabled / disabled. After you find the function you want to enable ( NetFx3 in this case), run this:

 dism /online /Enable-Feature /FeatureName:NetFx3 

And as Richard said, you can disable the function by simply switching "Enable" to "Disable" ex.

 dism /online /Disable-Feature /FeatureName:NetFx3 

Note. Sometimes, a reboot is required to view changes using Windows features.

+18
source

To enable and disable features on a Windows client computer using PowerShell, you must use the following cmdlet:

 Enable-WindowsOptionalFeature 

For example, on Windows 10 and NetFX 3, I would check if this feature is enabled using

 Get-WindowsOptionalFeature -Online | where featurename -Like "netfx3" 

If it is not turned on, run it to turn it on:

 Enable-WindowsOptionalFeature -Online -FeatureName "NetFx3" -Source "SourcePath" 
+15
source

I'm not sure how you are going to start the download, but you can get the files from the Windows 10 installation CD. Copy the folder named 'D:\sources\sxs' and save this file somewhere.

Once you have the files, you can install them with the following command, run it with administrator rights. Make sure you change the /Source: to the folder where you copied the sxs folder.

 DISM /online /enable-feature /featurename:NetFx3 /All /Source:D:\sources\sxs /LimitAccess 

If you want to deploy this function using the command line, you can use the following comamnd.

 DISM /online /disable-feature /FeatureName:NetFx3 
+1
source

Source: https://habr.com/ru/post/1243310/


All Articles