Category filter

Script to get the login information of the last logged-in user on Windows

This article will tell you how to deploy scripts to find the login information of the last logged-in user on your Windows device.

Many organizations have devices that are being used by multiple users. As an organization, have you ever wanted to monitor who’s logging into your Windows device and when? Monitoring and managing these shared devices manually can be daunting for IT admins. Hexnode lets admins automate this process with its custom scripts feature for Windows devices.

Disclaimer:

The Sample Scripts provided below are adapted from third-party Open-Source sites.

PowerShell Script to get last logged on user

The PowerShell script to fetch the last logged on user on the Windows machine is given below:

Notes:

  • It is recommended to manually validate the script execution on a system before executing the action in bulk.
  • Hexnode will not be responsible for any damage/loss to the system on the behavior of the script.

  • Sample Script Repository