phillips321 / adaudit

Powershell script to do domain auditing automation
https://www.phillips321.co.uk
374 stars 100 forks source link

resolves issue with single item in object #11

Closed fuggles-5555 closed 3 years ago

fuggles-5555 commented 3 years ago

I noticed an error when running the script on a DC with a single user who has a password that doesn't expire.

[*] Password Information Audit Method invocation failed because [Microsoft.ActiveDirectory.Management.ADPropertyValueCollection] does not contain a method named 'op_Division'. At C:\Users\anon\Desktop\AdAudit.ps1:356 char:9
...

I've resolved this by replacing the original line as below: Original; $totalcount = $nonexpiringpasswords.count New; $totalcount = ($nonexpiringpasswords | Measure-Object | Select-Object Count).count

The same count approach is used in several other locations. I've replaced each with the above method in this request.

phillips321 commented 3 years ago

Looks good, thanks for the PR