Home » PowerShell » How to Get Local Administrators Using PowerShell

How to Get Local Administrators Using PowerShell

To get the local administrators group members on the computer, use the `Get-LocalGroupMember` command. This command retrieves the members from a local group.

Here, is the PowerShell command to get local administrators on a local computer.

Get-LocalGroupMember -Group <Groupname>

In this article, we will discuss how to get local admins on the local computer using the PowerShell Get-LocalGroupMember cmdlet.

How to Get Local Admins Using PowerShell

Use the PowerShell command Get-LocalGroupMember along with the group name “Administrators” to retrieve the local administrator’s group members.

Get-LocalGroupMember -Group "Administrators"

In the above PowerShell script, the Get-LocalGroupMember command uses the Group parameter to specify the group name “Administrators” and retrieve the list of local admins group members.

The output of the PowerShell script is given below.

ObjectClass    Name          PrincipalSource
-----------            ----          ---------------
User               SHELLPRO\Gary
Group            SHELLPRO\Domain Admins

You can also use the net command to get the local admins on the computer.

net localgroup administrators

The output of the above PowerShell script gets the local admin group members.

Get Local Admin Group Members
Get Local Admin Group Members

Conclusion

I hope the above article on how to get local admins group members on the computer using the PowerShell Get-LocalGroupMember command is helpful to you.

The Get-LocalGroupMember cmdlet is available in Microsoft.PowerShell.LocalAccounts the module. The Microsoft.PowerShell.LocalAccounts module is not available in 32-bit PowerShell on a 64-bit system.

You can find more topics about PowerShell Active Directory commands and PowerShell basics on the ShellGeek home page.

Related Links

Microsoft.PowerShell.LocalAccounts Module

Add-LocalGroupMember

Get-LocalUser

New-LocalUser

Enable-LocalUser

Disable-LocalUser

Rename-LocalUser

Set-LocalUser