Subscribe
Home » How to Disable the Windows Command Prompt or PowerShell

How to Disable the Windows Command Prompt or PowerShell

by Staff
0 comment

The Windows Command Prompt and PowerShell tools are quite incredible. You can use them to configure various system settings or access various apps. However, entering the wrong commands in these tools can harm your device. In some instances, others might use these tools to run unwanted commands on your PC.

The best solution to such problems is to temporarily disable the Command Prompt or PowerShell. Fortunately, if you ever need to use these tools again in the future, you can re-enable them at any time. As such, here are the various ways to disable (and re-enable) the Command Prompt and PowerShell.


How to Disable the Windows Command Prompt

You can disable the Command Prompt using either the Local Group Policy Editor or the Registry Editor. So, let’s check out the steps you need to follow.

Using the Local Group Policy Editor

We’ll start by using the Local Group Policy Editor (LGPE). If you’re familiar with this tool, you probably know that it makes it easy to tweak various system settings. Not only that, but this tool can also help you block access to the Windows sound scheme settings.

If you can’t access this tool on the Windows Home edition, check out some tips on how to access the LGPE on Windows Home.

Now, here’s how to use the LGPE to disable the Command Prompt:

  1. Press Win + R to open the Run command dialog box.
  2. Type gpedit.msc and press Enter to open the LGPE.
  3. Navigate to User Configuration > Administrative Templates > System.
  4. Double-click on the Prevent access to the command prompt option on the right-hand side pane.

From there, select Enabled in the top-left corner. Next, press Apply and then press OK. This should disable the Windows Command Prompt.

If you decide to re-enable the Command Prompt, follow these steps:

  1. Open the LGPE and navigate to the System option by following the previous steps.
  2. Double-click on the Prevent access to the command prompt option.
  3. From there, select either Not Configured or Disabled from the options. Finally, press Apply and then press OK.

Using the Registry Editor

Alternatively, you could try using the Windows Registry Editor. This is an incredible tool that you can rely on for tweaking system settings or troubleshooting errors.

The Registry Editor carries sensitive keys that control how your Windows device works. So, you should be careful when editing or moving Registry keys. In fact, the best thing to do is to back up the Registry before making any changes to it.

Now, here’s how to use the Registry Editor to disable the Command Prompt:

  1. Press Win + R to open the Run command dialog box.
  2. Type Regedit and press Enter to open the Registry Editor.
  3. From there, copy-paste the following command into the address bar and press Enter:

HKEY_CURRENT_USERSoftwarePoliciesMicrosoftWindows

Click the System key under the Windows folder. If the System key is missing, create it by right-clicking on the Windows key and selecting New > Key. Next, rename the key as System and then press Enter.

When you’re on the System key, right-click on a blank space on the right and select New > DWORD (32-bit) Value. From there, name the value as DisableCMD.

To disable the Command Prompt, double-click on the DisableCMD value and set the Value data to 1. From there, press OK and then close the Registry Editor.

To re-enable the Command Prompt, apply the previous methods but set DisableCMD’s Value data to 0 (zero).

Now, let’s explore how you can disable the PowerShell tool.

Using the Local Group Policy Editor

Here’s how to use the LGPE to disable PowerShell:

  1. Press Win + R to open the Run command dialog box.
  2. Type gpedit.msc and press Enter to open the LGPE.
  3. Navigate to User Configuration > Administrative Templates > System.
  4. Double-click on the Don’t run specified Windows applications option on the right-hand side pane.


Next, select Enabled in the top-left corner. From there, navigate to the Options section in the bottom-left and click the Show button. This should pop up the Show Contents screen.

Type powershell.exe below the Value box and then press OK. Next, press Apply and then press OK in the LGPE window. This should disable the PowerShell tool.

In case you want to re-enable PowerShell, follow these steps:

  1. Open the LGPE and navigate to the System option as per the previous steps.
  2. Double-click on the Don’t run specified Windows applications option.
  3. Finally, select either Not Configured or Disabled in the top-left corner. Finally, press Apply and then press OK.

However, it’s worth noting that this method will make changes to all the programs that depend on the “Don’t run specified Windows applications” policy setting. For example, if you disable PowerShell using this policy setting, the other apps that depend on this policy setting will also be disabled.

Using the Registry Editor

Here’s how the Registry Editor can help you disable the PowerShell tool:

  1. Press Win + R to open the Run command dialog box.
  2. Type Regedit and press Enter to open the Registry Editor.
  3. From there, copy-paste the following command into the address bar and press Enter:
HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionPolicies

Click on the Explorer key. If this key is missing, create it by right-clicking on the Policies key and selecting New > Key. Name the key as Explorer and then press Enter.

Once you’re on the Explorer key, right-click on a blank space on the right and select New > DWORD (32-bit) Value. Next, name the value as DisallowRun. From there, double-click on the DisallowRun value and set the Value data to 1.

Next, follow these steps:

  1. Right-click on a blank space on the right-hand side and select New > key. Next, name this key as DisallowRun.
  2. Click the DisallowRun key and then right-click on a blank space on the right-hand side. Next, select New > String Value and then name the value as 1.
  3. Next, double-click on this newly-created value and set the Value data as powershell.exe. Press OK to save these changes. Now, you should have a value named “1,” with a data value displayed as “powershell.exe.”


The steps we’ve covered so far should disable the PowerShell tool. That’s because we started by setting the Value data of the DisallowRun value as 1.

Also, this method will disable all the apps that are in the DisallowRun folder/key.

To re-enable PowerShell (or other apps within the DisallowRun key), follow these steps:

  1. Open the Registry Editor and navigate to the Explorer key as per the previous steps.
  2. Double-click on the DisallowRun value on the right-hand side and set the Value data to 0. Press OK to save these changes.
  3. If you want to enable PowerShell for good, navigate to HKEY_CURRENT_USER > Software > Microsoft > Windows > CurrentVersion > Policies > Explorer > DisallowRun and delete the PowerShell string.

The Command Prompt and PowerShell Are Now Inaccessible

There’s no denying that the Command Prompt and PowerShell tools are useful and reliable. However, it’s often necessary to disable them—especially if you want to prevent others from running unwanted commands. To disable these tools, apply any of the methods we’ve covered.


While you’re at it, be sure to also check out the various ways to access the Command Prompt and PowerShell.



Read the full article here

You may also like

Leave a Comment

Iman Hearts is one of the biggest lifestyle news and articles portals, we provide the latest news and articles about family, lifestyle, entertainment, and many more, follow us to get the latest news about what matters to you.

 

© 2022 Iman Hearts. All rights reserved. Sitemap