Skip to content

Performance Improvements #50

@shockogit

Description

@shockogit

New to this project and came across with a google search when tasked internally with creating some reports for security people. Awesome work and so helpful for people like me who have a short time frame but large remit! :)

Some performance observations from a quick glance:

$OwnerDN = Get-ADGroup -Filter { name -eq $Group.Name } -Properties managedBy | Select-Object -ExpandProperty ManagedBy
Try{
$Manager = Get-ADUser -Filter { distinguishedname -like $OwnerDN } -t | Select-Object -ExpandProperty Name
}Catch{
	write-host -ForegroundColor Yellow "Cannot resolve the manager, " $Manager " on the group " $group.name
}

So:

  1. Why not use Get-AdGroup with the DN to avoid an AD Search? Much quicker.
  2. If we add each successful lookup of the manager to a hashtable we can look it up there and avoid the call to Get-ADGroup. Much quicker!:)

I have never used GitHub or powershell so I will learn how to get involved and make a code submission over next day or two.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions