PortValhalla/scripts/Windows/OS/User/AutoLogin.ps1

14 lines
468 B
PowerShell

#!/bin/pwsh
param(
[int]$EventID,
[string]$PreparedUsernameProperty,
[string]$PreparedSecretProperty
);
. "$PSScriptRoot/../../Scripts/Context.ps1";
$context = [Context]::new();
$userName = $context.Get($PreparedUsernameProperty);
$password = $context.Get($PreparedSecretProperty);
$context.SetAutologin($userName, $password);
Write-EventLog -LogName Application -Source "Application" -EventId $EventID -Message "This event was created by $env:Username";