PSHTML-AD-Report
PSHTML-AD-Report copied to clipboard
Performance Improvements
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:
- Why not use Get-AdGroup with the DN to avoid an AD Search? Much quicker.
- 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.