Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. $users = Get-ADUser -Filter * -Properties * -SearchBase "OU=something,DC=domain,DC=net"
  2. foreach ($user in $users) {
  3. $file = $user.Name + '_ACL'
  4. (Get-ADUser –Identity $user –Properties MemberOf).MemberOf -replace '^CN=([^,]+),OU=.+$','$1' | Out-File c:PSResults$file.txt
  5. }
  6.  
  7. (&(&(&(&(objectCategory=user)(userAccountControl=512)))))
  8.  
  9. $users = Get-ADUser -Filter * -Properties * -SearchBase "OU=something,DC=domain,DC=net"
  10. foreach ($user in $users) {
  11. $file = $user.Name + '_ACL'
  12. (Get-ADUser –Identity $user –Properties MemberOf).MemberOf -replace '^CN=([^,]+),OU=.+$','$1' | Export-CSV -path c:PSResults$file.csv -NoTypeInformation
  13. }
  14.  
  15. Get-ADPrincipalGroupMembership USERNAME | Select Name | Export-CSV -path C:Tempfile.csv -NoTypeInformation
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement