To restrict deprecated PowerShell usage by users, you can disable it completely. Follow these steps to disable PowerShell 2.0.
Microsoft is pushing almost everyone to use the PowerShell instead of the good old Command Prompt. The main reason being that the PowerShell is much more feature-rich and powerful than the regular Command Prompt. By default, any user can launch and use the PowerShell directly from the Command Prompt or from the File Explorer. This is very useful as you don’t have to go through hoops just to run a simple command or script. Of crouse, any major command or script requires admin privileges and proper execution policy setting.
In general, PowerShell has different versions. As of writing this, PowerShell v5 is the latest. However, due to compatibility reasons, Windows still has the old PowerShell 2.0 enabled. Being an older version, the PowerShell 2.0 is deprecated and even considered a security risk.
As such, unless you absolutely need PowerShell 2.0, it is recommended that you fully disable it. Follow the below steps to completely disable PowerShell 2.0 in Windows 10.
Related: How to disable Command Prompt in Windows
Disable PowerShell 2.0 Command
Using a simple PowerShell command, you can easily disable PowerShell 2.0 in Windows 10. All we have to do is execute a single line command.
1. First, open the start menu, search for “PowerShell“, right-click on the result and select the “Run as administrator” option. This action will open the PowerShell console window with admin rights.
2. In the console window, execute the below command. To do that, copy the below command and right-click inside the console window to paste it. Next, press the Enter button.
Disable-WindowsOptionalFeature -Online -FeatureName MicrosoftWindowsPowerShellV2Root
That is it. As soon as you execute the command, PowerShell 2.0 will be disabled immediately.
If you want to enable PowerShell 2.0 back again, execute the below command. As you can see from the command, all we did is replace “Disable” with “Enable”.
Enable-WindowsOptionalFeature -Online -FeatureName MicrosoftWindowsPowerShellV2Root
(Alternative) via Windows Features
Since PowerShell 2.0 is a deprecated feature, it is enabled as an optional feature. Which simply means that you can disable it from the Options Windows Features. This method is particularly useful if you don’t want to deal with PowerShell commands.
1. First, open the start menu, search for “Turn Windows features on or off” and click on the result to open the Optional Windows Features.
2. In this window, scroll down until you see the “Windows PowerShell 2.0” option. Uncheck the corresponding checkbox and click on the “Ok” button to save changes.
3. As soon as you click on the Ok button, Windows will make the necessary changes. Once completed, click on the “Close” button and you are done.
That is it. You’ve disabled Windows PowerShell 2.0.
If you want to re-enable PowerShell 2.0, follow the same steps but select the checkbox in step 2.
Do keep in mind that we are only disabling the deprecated PowerShell 2.0 but the regular PowerShell is still enabled. In fact, you can access as you would normally.
That is all. I hope that helps. If you are stuck or need some help, comment below and I will try to help as much as possible.