Created
January 16, 2015 14:42
-
-
Save ascjones/d37e8135d1837520d2b2 to your computer and use it in GitHub Desktop.
Powershell Prompt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function prompt { | |
# Admin ? | |
if( ( | |
New-Object Security.Principal.WindowsPrincipal ( | |
[Security.Principal.WindowsIdentity]::GetCurrent()) | |
).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) | |
{ | |
# Admin-mark in WindowTitle | |
$Host.UI.RawUI.WindowTitle = "[Admin] " + $Host.UI.RawUI.WindowTitle | |
# Admin-mark on prompt | |
Write-Host "[" -nonewline -foregroundcolor DarkGray | |
Write-Host "Admin" -nonewline -foregroundcolor Red | |
Write-Host "] " -nonewline -foregroundcolor DarkGray | |
} | |
Write-Host $pwd -foregroundcolor Green | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment