To test if the current user is an admin

Is the current user an administrator?

I inherited (from Rhys) this mini function for finding out:

function Test-Administrator
{
    $user = [Security.Principal.WindowsIdentity]::GetCurrent();
    (New-Object Security.Principal.WindowsPrincipal $user).IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)
}