Functions/Private/Test-IsAdmin.ps1

# Test if you run the shell as admin

function Test-IsAdmin {
    ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")
}

if ((Test-IsAdmin) -ne $true) {
    Write-Output "Please run this script with admin privileges."
    Read-Host
    Break
}