Open in the explorer

Remove "Run As Different User" from context menus

Type
Computer
GPO path
Computer Configuration › Policies › Administrative Templates › MS Security Guide
Supported on
At least Windows Vista
ADMX file
SecGuide.admx
Internal name
SecGuide/Pol_SecGuide_0301_RemoveRunasdifferentuser

Explanation

This setting controls whether "Run As Different User" appears on the Shift+RightClick context menu for .bat, .cmd, .exe, and .msc files.

Enabled (recommended): Keeps "Run As Different User" from appearing in the context menu when the user holds Shift while right-clicking on a .bat, .cmd, .exe, or .msc file in Explorer.

Disabled: Restores the Windows default behavior for "Run As Different User."

Registry

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer
Value name
not defined in the ADMX
StateValue written
Enabled
KeyValueData
SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\ExplorerNoStartBannerREG_DWORD = 1
SOFTWARE\Classes\batfile\shell\runasuserSuppressionPolicyREG_DWORD = 4096
SOFTWARE\Classes\cmdfile\shell\runasuserSuppressionPolicyREG_DWORD = 4096
SOFTWARE\Classes\exefile\shell\runasuserSuppressionPolicyREG_DWORD = 4096
SOFTWARE\Classes\mscfile\shell\runasuserSuppressionPolicyREG_DWORD = 4096
Disabled
KeyValueData
SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\ExplorerNoStartBannerDeletes the value
SOFTWARE\Classes\batfile\shell\runasuserSuppressionPolicyDeletes the value
SOFTWARE\Classes\cmdfile\shell\runasuserSuppressionPolicyDeletes the value
SOFTWARE\Classes\exefile\shell\runasuserSuppressionPolicyDeletes the value
SOFTWARE\Classes\mscfile\shell\runasuserSuppressionPolicyDeletes the value

PowerShell

PowerShell commands that write to the registry what the policy would write. Values in angle brackets (<…>) must be replaced.

Writing directly to the registry bypasses Group Policy: if a GPO manages this value, it will be rewritten at the next gpupdate; otherwise the value stays in place (the "tattooing" effect). Prefer a GPO or, locally, LGPO.exe. Run PowerShell as administrator for HKLM. Some policies need a restart or gpupdate /force.

Enable

# Enable: SecGuide/Pol_SecGuide_0301_RemoveRunasdifferentuser
$k = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer'
if (-not (Test-Path -Path $k)) { New-Item -Path $k -Force | Out-Null }
Set-ItemProperty -Path $k -Name 'NoStartBanner' -Value 1 -Type DWord
$k = 'HKLM:\SOFTWARE\Classes\batfile\shell\runasuser'
if (-not (Test-Path -Path $k)) { New-Item -Path $k -Force | Out-Null }
Set-ItemProperty -Path $k -Name 'SuppressionPolicy' -Value 4096 -Type DWord
$k = 'HKLM:\SOFTWARE\Classes\cmdfile\shell\runasuser'
if (-not (Test-Path -Path $k)) { New-Item -Path $k -Force | Out-Null }
Set-ItemProperty -Path $k -Name 'SuppressionPolicy' -Value 4096 -Type DWord
$k = 'HKLM:\SOFTWARE\Classes\exefile\shell\runasuser'
if (-not (Test-Path -Path $k)) { New-Item -Path $k -Force | Out-Null }
Set-ItemProperty -Path $k -Name 'SuppressionPolicy' -Value 4096 -Type DWord
$k = 'HKLM:\SOFTWARE\Classes\mscfile\shell\runasuser'
if (-not (Test-Path -Path $k)) { New-Item -Path $k -Force | Out-Null }
Set-ItemProperty -Path $k -Name 'SuppressionPolicy' -Value 4096 -Type DWord

Disable

# Disable: SecGuide/Pol_SecGuide_0301_RemoveRunasdifferentuser
$k = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer'
Remove-ItemProperty -Path $k -Name 'NoStartBanner' -ErrorAction SilentlyContinue
$k = 'HKLM:\SOFTWARE\Classes\batfile\shell\runasuser'
Remove-ItemProperty -Path $k -Name 'SuppressionPolicy' -ErrorAction SilentlyContinue
$k = 'HKLM:\SOFTWARE\Classes\cmdfile\shell\runasuser'
Remove-ItemProperty -Path $k -Name 'SuppressionPolicy' -ErrorAction SilentlyContinue
$k = 'HKLM:\SOFTWARE\Classes\exefile\shell\runasuser'
Remove-ItemProperty -Path $k -Name 'SuppressionPolicy' -ErrorAction SilentlyContinue
$k = 'HKLM:\SOFTWARE\Classes\mscfile\shell\runasuser'
Remove-ItemProperty -Path $k -Name 'SuppressionPolicy' -ErrorAction SilentlyContinue

Revert to "Not configured"

# Revert to "Not configured": SecGuide/Pol_SecGuide_0301_RemoveRunasdifferentuser
$k = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer'
Remove-ItemProperty -Path $k -Name 'NoStartBanner' -ErrorAction SilentlyContinue
$k = 'HKLM:\SOFTWARE\Classes\batfile\shell\runasuser'
Remove-ItemProperty -Path $k -Name 'SuppressionPolicy' -ErrorAction SilentlyContinue
$k = 'HKLM:\SOFTWARE\Classes\cmdfile\shell\runasuser'
Remove-ItemProperty -Path $k -Name 'SuppressionPolicy' -ErrorAction SilentlyContinue
$k = 'HKLM:\SOFTWARE\Classes\exefile\shell\runasuser'
Remove-ItemProperty -Path $k -Name 'SuppressionPolicy' -ErrorAction SilentlyContinue
$k = 'HKLM:\SOFTWARE\Classes\mscfile\shell\runasuser'
Remove-ItemProperty -Path $k -Name 'SuppressionPolicy' -ErrorAction SilentlyContinue

Application

Microsoft Security Baseline (MSS, SecGuide) (Microsoft) — November 2026 templates

Official templates downloaded on November 12, 2026.