Skip to content

Instantly share code, notes, and snippets.


Marc Cornellà mcornella

View GitHub Profile
View Set-LastLoggedOnUser.ps1
# Name: Set-LastLoggedOnUser
# Author: James Schlackman
# Last Modified: May 31 2019
# Sets the last logged on user on the Windows login screen to a specificied AD user. Will first check
# for a user in the managedBy attribute of the current computer and offer the option to use that
# user automatically. If declined, prompts for an AD username to use instead.
# This script uses ADSI for AD queries inatead of the ActiveDirectory module since that module is not
# installed by default on standard workstations.