Introduction

The right-click context menu in the Start menu provides quick access to several administrative tools, including Command Prompt and PowerShell. To restrict access for specific user profiles, you can either remove the corresponding shortcuts from the WinX folder or use Group Policy to hide these options.

Identifying the WinX Folder

The right-click menu options are located in the WinX folder. This folder can be found at:

%USERPROFILE%\AppData\Local\Microsoft\Windows\WinX

Within this folder, there are three subfolders (Group1, Group2, and Group3) that correspond to different sections of the right-click menu. To restrict access to cmd and PowerShell, focus on Group3.

Method 1: Removing Shortcuts Manually

To manually remove the shortcuts for cmd and PowerShell:

  1. Navigate to %USERPROFILE%\AppData\Local\Microsoft\Windows\WinX\Group3.
  2. Delete the shortcuts for Command Prompt and PowerShell.

This will remove the options from the right-click menu for the specific user profile.

Method 2: Using Group Policy

To hide the right-click options using Group Policy:

  1. Open the Group Policy Management Console (GPMC).
  2. Create a new Group Policy Object (GPO) or edit an existing one that applies to the target users.
  3. Navigate to User Configuration > Policies > Administrative Templates > Start Menu and Taskbar.
  4. Find and enable the policy Disable context menus in the Start Menu.

This policy will disable all context menus in the Start menu, including those for Command Prompt and PowerShell.

Example Script to Remove Shortcuts

Here is a PowerShell script to automate the removal of cmd and PowerShell shortcuts from the WinX folder:

# Define the path to the Group3 folder
$Group3Path = "$env:USERPROFILE\AppData\Local\Microsoft\Windows\WinX\Group3"

# Remove Command Prompt and PowerShell shortcuts
Remove-Item "$Group3Path\*cmd*.lnk" -Force
Remove-Item "$Group3Path\*powershell*.lnk" -Force

Run this script with administrative privileges to remove the shortcuts for the current user.


0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.