2024-03-22 09:32:53 +00:00
|
|
|
#!/bin/pwsh
|
2024-03-23 00:27:49 +00:00
|
|
|
param(
|
|
|
|
[int]$EventID,
|
|
|
|
[string]$PreparedUsernameProperty,
|
|
|
|
[string]$PreparedSecretProperty
|
|
|
|
);
|
2024-03-22 09:32:53 +00:00
|
|
|
|
2024-08-07 19:05:32 +00:00
|
|
|
. "$PSScriptRoot/../../../Common/Scripts/Context.ps1";
|
2024-03-23 00:27:49 +00:00
|
|
|
$context = [Context]::new();
|
|
|
|
$userName = $context.Get($PreparedUsernameProperty);
|
|
|
|
$password = $context.Get($PreparedSecretProperty);
|
|
|
|
$context.SetAutologin($userName, $password);
|
2024-03-24 17:16:29 +00:00
|
|
|
$context.Remove($PreparedUsernameProperty);
|
|
|
|
$context.Remove($PreparedSecretProperty);
|
|
|
|
Unregister-ScheduledTask -Confirm:$false $AutoLoginTaskName;
|
2024-03-23 00:27:49 +00:00
|
|
|
Write-EventLog -LogName Application -Source "Application" -EventId $EventID -Message "This event was created by $env:Username";
|
2024-03-24 17:16:29 +00:00
|
|
|
$context.Remove($AutoLoginTriggerProperty);
|