21 lines
676 B
PowerShell
21 lines
676 B
PowerShell
#!/bin/pwsh
|
|
. "$PSScriptRoot/../../Scripts/Context.ps1";
|
|
|
|
function Get-AutoLoginScript() {
|
|
return {
|
|
param(
|
|
[int]$EventID,
|
|
[string]$ContextScriptPath,
|
|
[string]$PreparedUsernameProperty,
|
|
[string]$PreparedSecretProperty
|
|
);
|
|
|
|
. "$ContextScriptPath";
|
|
$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";
|
|
};
|
|
}
|