瀏覽代碼

add option to pass short user identity

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

+ 5 - 0
bin/Get-ADUserNestedGroups.ps1

@@ -1,10 +1,15 @@
 Param
 (
     [string]$DistinguishedName,
+    [string]$UserIdentity = "",
     [array]$Groups = @(),
     [switch]$Duplicates
 )
 
+if ($UserIdentity -notin @($null, "")){
+    $DistinguishedName = (Get-ADUser -Identity $UserIdentity).distinguishedname
+}
+
 #The user to check.
 # $User = "max.mustermann@domain.com";