瀏覽代碼

also show parent object of each group

Tobias Simetsreiter 2 年之前
父節點
當前提交
27fa01dadb
共有 1 個文件被更改,包括 6 次插入1 次删除
  1. 6 1
      bin/Get-ADUserNestedGroups.ps1

+ 6 - 1
bin/Get-ADUserNestedGroups.ps1

@@ -35,7 +35,12 @@ If($ADObject)
         If(($Groups | Where-Object {$_.DistinguishedName -eq $GroupDistinguishedName}).Count -eq 0)
         {
             #Add group to array.
-            $Groups +=  $CurrentGroup;
+            $Groups +=  [PSCustomObject]@{
+                DistinguishedName=$CurrentGroup.DistinguishedName
+                Name=$CurrentGroup.Name
+                ObjectClass=$CurrentGroup.ObjectClass
+                Parent=$DistinguishedName
+            };
 
             #Get recursive groups.      
             $Groups = &$PSCommandPath -DistinguishedName $GroupDistinguishedName -Groups $Groups;