pdqcom / PowerShell-Scanners

A community repository of PowerShell Scanners for PDQ Inventory.
MIT License
179 stars 74 forks source link

User Ad Groups - returns "Cannot index into a null array" #73

Closed AndrewPla closed 2 years ago

AndrewPla commented 3 years ago

I receive an error "cannot index into null array" for some machines. These machines have an $account.LastLoggedOnUserSID of S-1-5-21-####-####-####-500

I get the error Cannot index into a null array. on line 13, which is $groups = $ds.FindOne().Properties['memberof']

I think that we need to only access the 'MemberOf' property only if $ds.findone() has results.

https://docs.microsoft.com/en-us/troubleshoot/windows-server/identity/security-identifiers-in-windows

CaseyM-PDQ commented 2 years ago

Fixed with latest merge