Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista Tutorial - loop through all ad objects

Reply
 
Old 08-27-2008   #1 (permalink)
William
Guest


 
 

loop through all ad objects

hi,

i need to loop through all ad objects to find if a user has rights to
anything. the object could be user, ou, computer, or anything in AD.

i am quite familiar with get-adpermission cmdlet and use it all the time.
however, it only accepts 1 DN. is there a way using powershell to start at
root of AD (or start at a specific DN) and loop through all children and
list rights a user has for everything below?

thank you.


My System SpecsSystem Spec
Old 08-27-2008   #2 (permalink)
Brandon Shell [MVP]
Guest


 
 

Re: loop through all ad objects

wholey smokes... that is quite a lot of parsing

Not sure about Get-ADPermission

But this works for me (using my Get-ADAcl.ps1 script from my blog)

Get-Qadobject -ldapFilter "Objectclass=*" -IncludedProperties 1.1 -size 0
| %{.\Get-ADACL.ps1 $_.dn}

Brandon Shell
---------------
Blog: http://www.bsonposh.com/
PSH Scripts Project: www.codeplex.com/psobject

W> hi,
W>
W> i need to loop through all ad objects to find if a user has rights to
W> anything. the object could be user, ou, computer, or anything in AD.
W>
W> i am quite familiar with get-adpermission cmdlet and use it all the
W> time. however, it only accepts 1 DN. is there a way using powershell
W> to start at root of AD (or start at a specific DN) and loop through
W> all children and list rights a user has for everything below?
W>
W> thank you.
W>


My System SpecsSystem Spec
Old 08-27-2008   #3 (permalink)
Brandon Shell [MVP]
Guest


 
 

Re: loop through all ad objects

1.1 doesnt seem to work for the get-qadobject... try this instead.

Get-Qadobject -ldapFilter "Objectclass=*" -DontUseDefaultIncludedProperties
-size 0 | %{.\Get-ADACL.ps1 $_.dn}

Brandon Shell
---------------
Blog: http://www.bsonposh.com/
PSH Scripts Project: www.codeplex.com/psobject

BS> wholey smokes... that is quite a lot of parsing
BS>
BS> Not sure about Get-ADPermission
BS>
BS> But this works for me (using my Get-ADAcl.ps1 script from my blog)
BS>
BS> Get-Qadobject -ldapFilter "Objectclass=*" -IncludedProperties 1.1
BS> -size 0 | %{.\Get-ADACL.ps1 $_.dn}
BS>
BS> Brandon Shell
BS> ---------------
BS> Blog: http://www.bsonposh.com/
BS> PSH Scripts Project: www.codeplex.com/psobject
W>> hi,
W>>
W>> i need to loop through all ad objects to find if a user has rights
W>> to anything. the object could be user, ou, computer, or anything in
W>> AD.
W>>
W>> i am quite familiar with get-adpermission cmdlet and use it all the
W>> time. however, it only accepts 1 DN. is there a way using
W>> powershell to start at root of AD (or start at a specific DN) and
W>> loop through all children and list rights a user has for everything
W>> below?
W>>
W>> thank you.
W>>


My System SpecsSystem Spec
Old 08-31-2008   #4 (permalink)
Shay Levy [MVP]
Guest


 
 

Re: loop through all ad objects

Hello William,


Try this, it gets all AD objects where 'domain\Administrators' group has
full control.

$account = 'domain\Administrators'
Get-QADObject -sizeLimit 0 -SecurityMask DACL | Get-QADPermission -inherited
-schemaDefault -account $account -rights GenericAll



---
Shay Levy
Windows PowerShell MVP
http://blogs.microsoft.co.il/blogs/ScriptFanatic

W> hi,
W>
W> i need to loop through all ad objects to find if a user has rights to
W> anything. the object could be user, ou, computer, or anything in AD.
W>
W> i am quite familiar with get-adpermission cmdlet and use it all the
W> time. however, it only accepts 1 DN. is there a way using powershell
W> to start at root of AD (or start at a specific DN) and loop through
W> all children and list rights a user has for everything below?
W>
W> thank you.
W>


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
WMI objects PowerShell
NET objects to COM objects .NET General
Using SMO objects PowerShell
Formating objects PowerShell
Creating a steam of custom objects in a loop PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46