Script to grab all users that have logged onto a specific machine through AD

Hello, I am needing to gather frequently all the users who are or have logged into many different machines. I am looking to automate this process with a script that is able to output all the usernames connected with that machine.

Unfortunantly I have very little experience with power shell. From my research it looks like many people are able to locate the last logged in user, but I’ve been unable to locate a script for all users.

Our active directory would have to log in using an admin account, but I could just log into the PC as an admin account if that’s not possible to add.

If anyone has any links or suggestions I’d be very grateful, thanks for reading!

Have you tried to search for it? There are several examples available throughout there in the internet.
A good place to look for is the PowershellGallery or the Microsoft Technet Script Gallery or even here in the forum.