Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Could you please help me ?
- Is it possible to get results like this - actually I want to compare to oracle user _id group file
- DN SamAccountName Groups
- abc.com user1 group1;group2;group3
- How to export the above results in columns, like :
- DN SamAccountName Groups
- abc.com user1 group1
- user1 group2
- user1 group3
- =================================================
- I asked this question - and got below reply thank to Andy but I am getting memory error since there are more than 20000 users.
- $users = Get-QADUser -searchRoot $OuDomain -SizeLimit 0
- $users | Sort-Object SamAccountName | % {
- $user = $_ | Select-Object dn, sAMAccountName
- if ($lastDomain -eq $user.dn) {
- $lastDomain = ""
- } else {
- $lastDomain = $user.dn
- }
- $groups = Get-QADMemberOf $_ | Select-Object -expandProperty Name
- $groups | % {
- $user2 = New-Object -TypeName PsObject -Property @{
- "Domain" = $lastDomain
- "sAMAccountName" = $user.sAMAccountName
- "Group" = $_
- }
- $user2
- }
- } | export-csv $FilePath
- Rgards
- Naveen
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement