0
1
I'm trying to find a way to authoritatively show whether a command prompt is running elevated or not, from the command prompt (CMD.exe), on a stock Windows installation. Most methods I've seen rely on non-native tools, third-party software, or proxy indicators which may not necessarily be reliable or compatible across all systems. I'm looking for something more along the lines of getting the system itself to explicitly state that the current session is elevated, or to show via command line that the current process is being run at an Integrity Level of High.
An example (but not necessarily absolute definition) of something that would be acceptable, would be a command that gets and displays the current PID followed by another command (if not same) that shows the Integrity Level for that PID. Commands which rely on the implications of a given output (e.g.: assuming the session is elevated if you can run certain commands, or determining elevation status based on the window's title bar) are not acceptable for this purpose.
Solutions should be compatible down to Windows 7 Pro SP0. Though these systems do have PowerShell, it is not an option for this purpose. Software not built-in to the OS is not an option.
@Ƭᴇcʜιᴇ007 Not quite exactly a duplicate, as this question has more strict limitations. However, one of the answers on the other question - the one that uses
whoami /groups
- appears to be appropriate for this one. – Iszi – 2014-09-10T18:41:10.107It's still a duplicate, IMO. It asked the question you wanted (just a little more broadly), and gave you an answer that works. Regardless, takes more than my vote to close it. :) – Ƭᴇcʜιᴇ007 – 2014-09-10T18:43:05.333
@Ƭᴇcʜιᴇ007 I don't disagree. I've taken the
whoami /groups
answer and expanded upon it a bit here for future reference, and also voted to close as duplicate. – Iszi – 2014-09-10T18:56:16.913Sounds good to me. Just to set the record straight, none of the down votes on this question and answers are from me. Just one of the close as dupe votes... – Ƭᴇcʜιᴇ007 – 2014-09-10T18:58:45.620
@Ƭᴇcʜιᴇ007 Thanks for the feedback. Don't know why anyone is down-voting the question. The existence of a duplicate is not an SE-appropriate reason for down-vote. As for my answer, the down-vote came in before I finished fully fleshing it out. So, I wouldn't really blame anyone for that since it was effectively a link-only answer at the time. (Though, technically, that should be a flag - not a down-vote.) – Iszi – 2014-09-10T19:04:27.340
Also whoami /groups has an edge case where you get the wrong information. See http://stackoverflow.com/questions/4051883/batch-script-how-to-check-for-admin-rights/30921854#30921854
– zumalifeguard – 2015-06-18T17:28:03.007@zumalifeguard Good to know, but it seems like a very rare case. Under what common conditions might a user experience that? – Iszi – 2015-06-18T17:56:52.047