Hi All
I'm trying to construct a PowerShell report which will give me a list of Users created and deprovisioned in the previous calendar month.
So far, I have it working, but the search for deprovisioned users takes forever (An hour or two - I have 100,000 user objects in AD) using this command:
get-qaduser -SearchAttributes @{edsvaDeprovisionStatus='1'} -SizeLimit 0 -DontUseDefaultIncludedProperties -IncludedProperties userprincipalname,mail,edsvadeprovisionreportxml,edsvaDeprovisionStatus
After I get the list of users, I then have to deconstruct the XML report in the edsvadeprovisionreportxml attribute of each user to find the date the Deprovision was requested like this:
[xml]$xml = $_.edsvadeprovisionreportxml
[datetime]$DeprovDate = $xml.report.table.row.sections.section[1].list.item | where {$_.name -eq 'Requested:'} | %{$_.t.date}
2 questions:
1 - Can this query be improved for faster performance? I'm wondering if it's possible to have ARS index the edsvaDeprovisionStatus attribute for better search performance. Maybe different search criteria or syntax?
2. Is it possible to search for the deprovision date "natively", or am I stuck with the XML report deconstruction?
Thanks
Joe