PowerShell is a command-line shell developed by Microsoft, and it’s available for Windows, Unix, and Linux.
With its help, we can install, uninstall, and upgrade Windows features, and in today’s article, we’re going to show you how to Turn Windows Features On or Off with PowerShell.
- The PowerShell command below will turn Windows features on or off, depending on the condition.
- Enabling or disabling Windows features is an easy task, and you can do it from the command prompt.
Check if Windows Features are turned on
- Click Start then type PowerShell in the search box.
- Right-click PowerShell and select Run as administrator.
- In the PowerShell window, type Get-WindowsFeature.
- If Windows Features are turned on, you will see a list of features, including Group Policy, IIS Administration Tools, Internet Information Services, Network Policy Server, Remote Desktop, Remote Server Administration Tools, Server Manager Tools, and SQL Server.
Check if you have administrative privileges
- To check if the user’s account has administrative privileges, open Run.
- Type “control” and “properties” and hit Enter.
- On the System Properties window, look for the User Account tab, and click Change account type.
- Check if the Account Type says Admin.
- If you have administrative privileges, proceed to the next step.
- Open PowerShell as administrator.
- Type “Get-WindowsFeature” in the PowerShell window and press Enter to run it.
- Check for the following features: Windows Defender Antivirus, Windows Firewall, Windows Defender Firewall, Windows Defender Application Control, Windows AppLocker, and Hyper-V.
- After finding the features, type the following in the PowerShell window: Get-WindowsFeature -Online | Where-Object {$_.name -eq “Windows Defender Application Control”} | Remove-WindowsFeature
- Try enabling Windows Defender Application Control again.
Use Group Policy Editor
-
Press Windows + R, type gpedit.msc, and hit Enter.
Navigate to the following path: Computer Configuration > Administrative Templates > System > Windows Components.
Double-click Turn off Windows features.
Double-click Turn off Windows Components. - Now, press the Enable radio button next to Windows components.
- Uncheck all components except the ones you need.
- Click Apply and OK to save changes.
