Fixed issue with displaying the LastLoggedOnDisplayName when the reg key does not exist

This commit is contained in:
Ben Whitmore 2020-07-22 15:09:19 +01:00
parent 070b85950e
commit 3ed1e99178

View file

@ -100,7 +100,7 @@ If ($XMLValid -eq $True) {
#Get last(current) logged on user
$LoggedOnUserPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI"
If (!(Test-Path $LoggedOnUserPath)) {
If (!((Get-ItemProperty $LoggedOnUserPath).LastLoggedOnDisplayName)) {
Try {
$Firstname = $Null
}