PowerShellEmpire/PowerTools

Get-OUs

Closed this issue · 4 comments

Something along the lines of:

function Get-OUs {
    $info = ([adsisearcher]"objectclass=organizationalunit")
    $info.PropertiesToLoad.AddRange("CanonicalName")
    $info.findall().properties.canonicalname
}

So something different than

function Get-NetOU {
?

Ah no :) Just couldn't find it

There's also now an option in Get-NetUser and Get-NetComputer which allows you to specify the ADSpath/OU/etc. for querying users/computers from particular OUs

.PARAMETER ADSpath
. Still needs some more testing, but seems to work nicely when combined with Get-NetGuidOU (
function Get-NetGuidOU {
) to pull OUs that GPP is applied to, and then extracting the machines from that particular OU easily :)

It would also be handy for Get-NetGroup as often see things like OU=Admins which contain the more interesting groups :)

Although I expect if you refactor more methods with the Get-DomainSearcher helper this parameter can be supported by default?