microsoft / microsoft/sudo

`is-elevated` command

Open
#118 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue-Feature Needs-Triage
Dominant language
Rust
Stars
5.9k
Forks
180
Avg merge
1d 7h
Merged PRs (30d)
2

Description

Description of the new feature / enhancement

Could you please add new is-elevated command.
It should check for elevated permissions and return 0 if process is already elevated.

sudo is-elevated && echo Already elevated
Scenario when this would be used?

This is useful feature and can be used in many scenarios.

For example if will allow to create self-elevated scripts:

test.cmd:

:: check for elevated permissions
:: - if already elevated - continue run
:: - if NOT elevated - elevate myself, run and exit
sudo is-elevated || ( sudo -E "%~sf0" %* & exit /B )

echo Run elevated code here
Supporting information

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the command entry point for sudo and the existing Windows permission or elevation checks. Verify how a new is-elevated command should return status 0 when already elevated, then test it from the batch scenarios shown in the issue, including both elevated and non-elevated processes.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli, operating-systems
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.