Last active
August 29, 2015 14:26
-
-
Save josephkern/e4d1e8a426ff45cce461 to your computer and use it in GitHub Desktop.
Revisions
-
josephkern revised this gist
Aug 5, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ function Get-ADMemberOf { # A fast and accurate way of determining all of the groups # one or more users are part of, especially useful when the groups are nested. # Example: -
josephkern renamed this gist
Aug 5, 2015 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
josephkern revised this gist
Aug 5, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ function Get-ADMemberOf { # A fast and accurate way of dertermining all of the groups # one or more users are part of, especially useful when the groups are nested. -
josephkern revised this gist
Aug 5, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ function Get-MemberOf { # A fast and accurate way of dertermining all of the groups # one or more users are part of, especially useful when the groups are nested. # Example: # import-module ActiveDirectory -
josephkern created this gist
Aug 5, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ function Get-MemberOf { # A fast and accurate way of dertermining all of the groups # a user is part of, especially useful when the groups are nested. # Example: # import-module ActiveDirectory # get-aduser <username> | Get-MemberOf | ft param( [Parameter(Mandatory=$True,ValueFromPipeline=$True,ValueFromPipelinebyPropertyName=$True)] [string]$DistinguishedName ) begin {} process { $tokens = get-aduser -SearchScope Base -SearchBase $DistinguishedName -Properties tokengroups -LDAPFilter '(objectClass=user)' $tokens.tokengroups | % { $objectProperties = @{ "GroupName" = $_.Translate([System.Security.Principal.NTAccount]); "SamAccountName" = $tokens.SamAccountName } New-Object -TypeName PSObject -Property $objectProperties } } end {} }