Powershell Not detecting Administrator as Administrator

When I run this on several laptops logged in as local admin the value comes back true. I have one laptop that when I am logged in as local admin the value comes back false. Can anyone give me ideas on where to begin to troubleshoot his issue.

$Identity=[System.Security.Principal.WindowsIdentity]::GetCurrent()
$Principal = New-Object System.Security.Principal.WindowsPrincipal($Identity)
$Principal.IsInRole([System.Security.Prinicipal.WindowsBuiltInRole]::Administrator)

You have a typo in your code. It should not work anywhere actually … :wink:
In line 3 it should be [System.Security.Principal.WindowsBuiltInRole] instead of [System.Security.Prinicipal.WindowsBuiltInRole]

Apologies on the typo. But what I am trying to understand is how come when I am logged in as local admin and I run this code the result comes back as false. Is there a way to check if user is a member of local admin and run with elevated privledges.

$Identity=[System.Security.Principal.WindowsIdentity]::GetCurrent()
$Principal = New-Object System.Security.Principal.WindowsPrincipal($Identity)
$Principal.IsInRole([System.Security.Principal.WindowsBuiltInRole]::Administrator)

It seems to me that your problem is not related with Powershell scripting.