From 3ed1e9917885237d019a52ada66d56e6f5203bf3 Mon Sep 17 00:00:00 2001 From: Ben Whitmore <44303264+byteben@users.noreply.github.com> Date: Wed, 22 Jul 2020 15:09:19 +0100 Subject: [PATCH] Fixed issue with displaying the LastLoggedOnDisplayName when the reg key does not exist --- Toast_Notify.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Toast_Notify.ps1 b/Toast_Notify.ps1 index eb1c2f6..4113813 100644 --- a/Toast_Notify.ps1 +++ b/Toast_Notify.ps1 @@ -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 }