Powershell: aktive Benutzer und ihre Gruppen (active users and their groups)

In den letzten Tagen hatte ich die Notwendigkeit, eine Liste von Benutzern und ihren Gruppen zu erstellen. Folgendes Powershell Skript, das die QAD Extensions nutzt (), war sehr hilfreich.

Clear-History
Clear-Host
 
$users = Get-QADUser
# for single user: $users = Get-QADUser 'uwe'
 
 
foreach ($Person in $users) {
      $Person
      $groups = Get-QADMemberOf $Person -Name "group*" 
      # match all AD-groups with wildcard name "group*"
      if ($groups) { # avoids error if no group was found
            foreach ($group in $groups) {
                  "" + $group.get_Name() + "`t" + $Person.get_Name()  | Out-File "d:\users_groups.csv" -Append
            # puts all users into file 
            }
      }
}

Wenn jemand eine Möglichkeit hat, das ohne die QAD Extensions zu schaffen, bitte informiert mich.

Uwe

Uwe Ziegenhagen likes LaTeX and Python, sometimes even combined. Do you like my content and would like to thank me for it? Consider making a small donation to my local fablab, the Dingfabrik Köln. Details on how to donate can be found here Spenden für die Dingfabrik.

More Posts - Website