Introducing Sudo for Windows We’re excited to announce the release of Sudo for Windows in Windows 11 Insider Preview Build 26052! Sudo for Windows is a new way for users to run elevated commands directly from an unelevated console session. It is an ergonomic and familiar solution for users who want to elevate a command without having to first open a new elevated console.
It’s more complicated than that. It seems to be able to configurably block user input for sudo’d commands, retain the existing environment, ditch it and open a new window, and remember that you’ve sudo’d in the last minute or so.
No, it really is super simple, just:
Set-HostElevatedPrivilege -SubstituteUser Administrator -Privilege [Microsoft.Automation.HostPrivilege]::new("Administrators", $(hostname)) -Credential $(Get-Credential) -Command "ping 1.1.1.1"
It’s more complicated than that. It seems to be able to configurably block user input for sudo’d commands, retain the existing environment, ditch it and open a new window, and remember that you’ve sudo’d in the last minute or so.