internal/functions/Test-RunningElevated.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
Function Test-RunningElevated {
  <#
  .SYNOPSIS
    Returns whether or not the current session is running with elevated privileges
  .DESCRIPTION
    Returns whether or not the current session is running with elevated privileges
  #>

  [cmdletbinding()]
  [OutputType([Boolean])]
  Param()
  ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')
}