en-US windows computer

Configure the behavior of the sudo command

Verified with Windows 11 25H2 — updated on July 30, 2026

Windows 11 25H2

Supported on: At least Windows 11

Path in the GPO console

Computer Configuration\Administrative Templates\System

Description

This policy setting controls use of the sudo.exe command line tool. If you enable this policy setting, then you may set a maximum allowed mode to run sudo in. This restricts the ways in which users may interact with command-line applications run with sudo. You may pick one of the following modes to allow sudo to run in: "Disabled": sudo is entirely disabled on this machine. When the user tries to run sudo, sudo will print an error message and exit. "Force new window": When sudo launches a command line application, it will launch that app in a new console window. "Disable input": When sudo launches a command line application, it will launch the app in the current console window, but the user will not be able to type input to the command line app. The user may also choose to run sudo in "Force new window" mode. "Normal": When sudo launches a command line application, it will launch the app in the current console window. The user may also choose to run sudo in "Force new window" or "Disable input" mode. If you disable this policy or do not configure it, the user will be able to run sudo.exe normally (after enabling the setting in the Settings app).

Registry

HKLM Software\Policies\Microsoft\Windows\Sudo

More options available

Options

Maximum allowed sudo mode
Enabled enum
  • Disabled -> 0 (default)
  • Force new window -> 1
  • Disable input -> 2
  • Normal -> 3

MDM / Intune (CSP)

./Device/Vendor/MSFT/Policy/Config/Sudo/EnableSudo
Device Since Windows 11, version 24H2 [10.0.26100] and later Official mapping (Microsoft Learn)

Microsoft Learn documentation Mapping data: Microsoft Learn (CC BY 4.0)

CSP values
  • 0 - Sudo is disabled.
  • 1 - Sudo is allowed in 'force new window' mode.
  • 2 - Sudo is allowed in 'disable input' mode.
  • 3 (Default) - Sudo is allowed in 'inline' mode.

Export Builder

BETA

Configure the state, scope and options, then generate .reg, PowerShell, Intune and SCCM outputs — or add the setting to a multi-setting collection.

These exports write the registry — this is not a managed GPO.

.reg file

Windows Registry Editor Version 5.00

; Exported from gporais.com
; Policy: Configure the behavior of the sudo command
; State: Enabled
; Supported on: At least Windows 11

[HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\Sudo]
"Enabled"=dword:00000000
More formats (PowerShell, Intune, SCCM)

PowerShell

# Exported from gporais.com
# Policy: Configure the behavior of the sudo command
# State: Enabled
# Supported on: At least Windows 11

$path = 'HKLM:\Software\Policies\Microsoft\Windows\Sudo'
New-Item -Path $path -Force | Out-Null
Set-ItemProperty -Path $path -Name 'Enabled' -Value 0 -Type DWord

Building a multi-setting collection? Add this setting and generate combined .reg / PowerShell / GPO scripts.

Open the Builder

Embed this policy on your site

What to embed
Theme

Adds one script line: the theme follows your site’s appearance and the height fits the content. If your site blocks scripts, the embed follows the visitor’s system theme.

Preview