diff --git a/Sophia/LTSC/Module/Sophia.psm1 b/Sophia/LTSC/Module/Sophia.psm1 index ff785505..5174911e 100644 --- a/Sophia/LTSC/Module/Sophia.psm1 +++ b/Sophia/LTSC/Module/Sophia.psm1 @@ -93,11 +93,11 @@ function Checkings # Check whether the logged-in user is an admin $CurrentUserName = (Get-Process -Id $PID -IncludeUserName).UserName | Split-Path -Leaf $CurrentSessionId = (Get-Process -Id $PID -IncludeUserName).SessionId - $LoginUserName = (Get-Process -IncludeUserName -ErrorAction SilentlyContinue | Where-Object -FilterScript {($_.Name -eq "explorer") -and ($_.SessionId -eq $CurrentSessionId)}).UserName | Split-Path -Leaf + $LoginUserName = (Get-Process -IncludeUserName -ErrorAction SilentlyContinue | Where-Object -FilterScript {($_.Name -eq "explorer") -and ($_.SessionId -eq $CurrentSessionId)}).UserName | Select-Object -Index 1 | Split-Path -Leaf - switch ($CurrentUserName -eq $LoginUserName) + switch ($CurrentUserName -ne $LoginUserName) { - $false + $true { Write-Warning -Message $Localization.LoggedInUserNotAdmin exit