Skip to main content

Set Last Logged In User

Summary

This is an RMM implementation of the agnostic script Set-LastLoggedOnUser to manage the last logged-in user's information displayed on the Windows login screen.

Sample Run

Sample Run Image

  • Select the parameters below to clear the last logged-in user's information from the login screen. The computer must be restarted manually afterward to implement the changes.
    Clear User Info
    Clear User Info

  • Similarly, to clear the last logged-in user's information from the login screen and forcefully restart the computer, select the parameters below.
    Force Restart

  • The parameters below set the specified local user as the last logged-in user. The computer must be restarted manually afterward to implement the changes.
    Set Local User

  • The parameters below set the specified domain user as the last logged-in user and forcefully restart the computer.
    Set Domain User

Dependencies

Set-LastLoggedOnUser

User Parameters

NameExampleRequiredDescription
Clear1TrueClears the last logged-in user's information from the login screen.
UserNameDomain/UserNameFalseSets the specified username as the last logged-in user. The username should be in the format 'Domain/User' or 'User'.
DisplayNameUser NameFalseOptionally specifies the display name to set for the last logged-in user. If not provided, it defaults to the username.
Reboot1FalseOptionally restarts the computer to apply the changes immediately.

Task Creation

Create a new Script Editor style script in the system to implement this Task.

Task Creation

Name: Set Last Logged In User
Description: This script manages the last logged-in user's information displayed on the Windows login screen and can optionally restart the computer to apply changes.
Category: Custom
Task Category

Parameters

Add a new parameter by clicking the Add Parameter button present at the top-right corner of the screen.
Add Parameter

This screen will appear.
Parameter Screen

  • Set Clear in the Parameter Name field.

  • Select Number Value from the Parameter Type dropdown menu.

  • Click the Save button.
    Save Parameter

  • It will ask for confirmation to proceed. Click the Confirm button to create the parameter.
    Confirm Parameter

Add another parameter by clicking the Add Parameter button present at the top-right corner of the screen.
Add Parameter

  • Set UserName in the Parameter Name field.

  • Select Text String from the Parameter Type dropdown menu.

  • Click the Save button.
    Save UserName

  • It will ask for confirmation to proceed. Click the Confirm button to create the parameter.

Add another parameter by clicking the Add Parameter button present at the top-right corner of the screen.

  • Set DisplayName in the Parameter Name field.
  • Select Text String from the Parameter Type dropdown menu.
  • Click the Save button.
  • It will ask for confirmation to proceed. Click the Confirm button to create the parameter.

Add another parameter by clicking the Add Parameter button present at the top-right corner of the screen.

  • Set Reboot in the Parameter Name field.
  • Select Number Value from the Parameter Type dropdown menu.
  • Click the Save button.
  • It will ask for confirmation to proceed. Click the Confirm button to create the parameter.

All the parameters will look like the following:
Parameters

Task

Navigate to the Script Editor Section and start by adding a row. You can do this by clicking the Add Row button at the bottom of the script page.
Add Row

A blank function will appear.
Blank Function

Row 1 Function: PowerShell Script

Search and select the PowerShell Script function.
PowerShell Script

The following function will pop up on the screen:
PowerShell Function

Paste the following PowerShell script and set the expected time of script execution to 900 seconds. Click the Save button.

PowerShell Script

Save Script

Click the Save button at the top-right corner of the screen to save the script.

Completed Task

Completed Task

Output

  • Script Log

Changelog

2025-04-10

  • Initial version of the document