18 lines
659 B
PowerShell
18 lines
659 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);
|
|
$context.Remove($PreparedUsernameProperty);
|
|
$context.Remove($PreparedSecretProperty);
|
|
Unregister-ScheduledTask -Confirm:$false $AutoLoginTaskName;
|
|
Write-EventLog -LogName Application -Source "Application" -EventId $EventID -Message "This event was created by $env:Username";
|
|
$context.Remove($AutoLoginTriggerProperty);
|