2013/01/07

Get-LocalGroupAllMembers

In my previous post, I explain my PowerShell function to retrieve the local administrators group membership.
Today I will go a bit further and find the nested members from the Active Directory.

Get-LocalGroupAllMembers


The following scripts query a localgroup on the localhost or a remote computer, and gather all the local and domain members (direct and nested).

By Default, if you do not specify any parameter, the function will query the Localhost and the Localgroup "Administrators".

Dot Sourcing

Once your Powershell is launched you can load the function using the Dot Sourcing method:
. ./Get-LocalGroupAllMembers.ps1

Usage


Get-LocalGroupAllMembers -ComputerName SERVER01 -GroupName "Administrators"

The Code



1 comment:

  1. Is there any way to get the samaccountname attribute returned for all results as well?

    ReplyDelete