I would like to inventory the users and groups that are allowed to connect to a computer (interactively or remotely). The computer can be either in a workgroup or in an active directory but primarily in an active directory. If a group has access, I would also like to know which users are members of that group so that I can determine if the user has access granted directly or thanks to a role.
I would like to do it using PowerShell and remotely but I don't know from where to start.
NB: Part of the solution can be found here (who has logged on?)
logonworkstations
property foreach user inget-aduser
. that should be your starting point.