Restricting CMD & Powershell
1. Restricting Command Prompt (CMD)
To disable Command Prompt (cmd.exe), follow these steps:
Open the Group Policy Editor:
Press
Win + R
, typegpedit.msc
, and press Enter.
Navigate to the following path:
User Configuration > Policies > Administrative Templates > System
Find and configure the "Prevent access to the command prompt" policy:
Look for the policy "Prevent access to the command prompt" in the right-hand pane.
Double-click to open the settings window.
Set it to Enabled.
You can also configure the option to Disable the command prompt script processing if needed.
Click Apply and then OK.
This policy will prevent users from accessing the Command Prompt. If the user tries to launch it, they will see an error message.

2. Restricting PowerShell
To block PowerShell, follow these steps:
Open the Group Policy Editor:
Press
Win + R
, typegpedit.msc
, and press Enter.
Navigate to the following path:
User Configuration > Administrative Templates > System
Find and configure the "Don't run specified Windows applications" policy:
Double-click on "Don't run specified Windows applications".
Set it to Enabled.
In the "List of disallowed applications", click on Show, then type
powershell.exe
andpowershell_ise.exe
in the list.
Click Apply and then OK.
This policy will prevent users from running PowerShell or the PowerShell ISE (Integrated Scripting Environment).

Last updated