Also mainly because when I create screenshots for a blog article or document, I want those screenshots to provide me with some marketing.
So, I customize my PowerShell prompt:
But I want to be able to, looking at my prompt, identify if I’m running an elevated prompt or not.
Looking at Linux, you can see that by the fact that there’s a # in the prompt:
So, here’s the code I use, which I’ve also put in my PowerShell profile 🙂
1 2 3 4 5 6 7 8 9 10 11 12 13 |
if (( [Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent() ).IsInRole( [Security.Principal.WindowsBuiltInRole] "Administrator" )){ function prompt { 'JeffWouters.nl #> ' } } else { function prompt { 'JeffWouters.nl > ' } } |