Admin Title Bar for PowerShell

I like this feature in Vista that elevated command prompts have the word “Administrator” in the title bar. This seems to be some special functionality baked into the command prompt – at least this does not work when starting PowerShell elevated.

This little script can do the trick – just call it from your profile.ps1:

$id = [System.Security.Principal.WindowsIdentity]::GetCurrent()
$p = New-Object System.Security.Principal.WindowsPrincipal($id)

if ($p.IsInRole([System.Security.Principal.WindowsBuiltInRole]::Administrator))
{
 $Host.UI.RawUI.WindowTitle = “Administrator: ” + $Host.UI.RawUI.WindowTitle
}

Thanks to Christian for the title bar code.

 

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s