Skip to content

Instantly share code, notes, and snippets.

@ascjones
Created January 16, 2015 14:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ascjones/d37e8135d1837520d2b2 to your computer and use it in GitHub Desktop.
Save ascjones/d37e8135d1837520d2b2 to your computer and use it in GitHub Desktop.
Powershell Prompt
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