Enhancing PowerShell with Sudo in Windows
If transitioning from Linux to Windows, one of the most frustrating aspects of using PowerShell is the requirement to launch it as an administrator to enact system modifications. The most straightforward method to do this is by right-clicking on the application in the Start menu and selecting “Run as administrator.” However, this approach lacks sophistication.
This inconvenience stands in stark contrast to most Linux distributions which resolved this issue long ago with the introduction of the sudo
command. On Linux, appending “sudo” before any command allows it to be executed with administrative privileges; a prompt requests the administrator’s password, and the action is carried out. This practicality has even inspired one of the renowned comics by XKCD.
Recognizing this need, Microsoft has introduced a feature that mimics the functionality of sudo, albeit with some technical discrepancies. While the new Windows feature is dubbed “sudo,” it does not function in precisely the same way as its Linux counterpart (a classic case of Microsoft creating confusion with terminology).
This pseudo-sudo functionality debuted with Windows 11 version 24H2, which was rolled out in October 2024 and continues to be released to Windows users through February 2025. To verify access to this feature, navigate to System Settings and then to System > For developers. Look for an option to enable sudo; if it’s not available, your system is likely not running version 24H2.

There are three modes for executing commands with sudo. By default, commands will run in a new window, but two alternative options are available: Inline, where commands execute in the same window, and Input closed, which also runs commands within the same window but without accepting input from it. For safety reasons, the official documentation suggests retaining the default setting, although the Inline option is a closer match to the Linux sudo command.
Using this functionality is easy: prepend your command with sudo
, and a prompt will appear seeking confirmation.

Simply select Yes to allow the command to execute with elevated permissions. Essentially, just prefix your commands with sudo to run them as an administrator.

Experiment with your regular commands and assess your experience. If you find it lacking, you can always revert to running PowerShell as an administrator.
There are several scenarios where Microsoft’s implementation of sudo may not fully meet your needs. You might not be utilizing the 24H2 version of Windows, or you may encounter challenges in getting sudo to work with specific applications. Alternatively, you might prefer a speedy method to switch your current session to an elevated status. In such cases, gsudo could be a preferable option. This open-source utility is recommended in Microsoft’s documentation as it offers functionalities that closely resemble the Linux version of sudo, and it can be quickly installed via the winget package manager.