diff --git a/scripts/Windows/OS/User.ps1 b/scripts/Windows/OS/User.ps1 index 6b7ff48c..348162e4 100644 --- a/scripts/Windows/OS/User.ps1 +++ b/scripts/Windows/OS/User.ps1 @@ -6,7 +6,7 @@ $uacDisablerTriggerProperty = "UACDisablerTrigger"; function New-PersonalUser([Context] $context) { - if (-not (Get-LocalUser $context.UserName)) + if (-not (Get-LocalUser $context.UserName -ErrorAction SilentlyContinue)) { Write-Host "Creating Personal User"; @@ -144,6 +144,6 @@ function Enable-PersonalUserAutologon([Context] $context) } $context.Set($preparedUsernameProperty, $context.UserName, "ExpandString"); - $context.Set($preparedUsernameProperty, $password, "ExpandedString"); + $context.Set($preparedUsernameProperty, $password, "ExpandString"); Write-EventLog -LogName Application -Source "Application" -EventId $context.Get($autoLoginTriggerProperty) -Message "This event was created by $env:Username"; }