$group = "MEINEGRUPPE" # https://technet.microsoft.com/en-us/library/ff730967.aspx $strFilter = "(&(objectCategory=Group)(name=$group))" $objDomain = New-Object System.DirectoryServices.DirectoryEntry $objSearcher = New-Object System.DirectoryServices.DirectorySearcher $objSearcher.SearchRoot = $objDomain $objSearcher.PageSize = 1000 $objSearcher.Filter = $strFilter $objSearcher.SearchScope = "Subtree" $colProplist = "name","member" foreach($i in $colPropList) { $objSearcher.PropertiesToLoad.Add($i) } $colResults = $objSearcher.FindAll() foreach($objResult in $colResults) { $objItem = $objResult.Properties # PHP-Style var_dump(): #echo $objItem | %{echo $_;} $members = $objItem.member Write-Output $members } $filename = "$group.txt" $membersReadable = $members | Out-String "$group" | Out-File -FilePath $filename "$membersReadable" | Out-File -FilePath $filename -append
Dienstag, 27. September 2016, 21:44 Uhr
Mit PowerShell alle Mitglieder einer Active Directory-Gruppe auflisten
Tags: Active Directory, AD, Group, Group Members, Gruppe, Gruppenmitglieder, Members, Microsoft, PowerShell, Query
Labels: IT