Move cleanup scripts to proper location
This commit is contained in:
parent
87a83600db
commit
ab17fa75d6
3 changed files with 7 additions and 6 deletions
|
@ -74,9 +74,9 @@ function New-PersonalUser([Context] $context, [string] $userName)
|
||||||
}
|
}
|
||||||
$postProcessStage {
|
$postProcessStage {
|
||||||
Enable-PersonalUserAutologon $context $userName;
|
Enable-PersonalUserAutologon $context $userName;
|
||||||
$context.RegisterReboot();
|
|
||||||
Set-UserStage $adminRemovalStage;
|
Set-UserStage $adminRemovalStage;
|
||||||
Start-EventDrivenTask $context.Get($uacDisablerTriggerProperty);
|
Start-EventDrivenTask $context.Get($uacDisablerTriggerProperty);
|
||||||
|
$context.Reboot();
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
$adminRemovalStage {
|
$adminRemovalStage {
|
||||||
|
|
|
@ -10,4 +10,8 @@ $context = [Context]::new();
|
||||||
$userName = $context.Get($PreparedUsernameProperty);
|
$userName = $context.Get($PreparedUsernameProperty);
|
||||||
$password = $context.Get($PreparedSecretProperty);
|
$password = $context.Get($PreparedSecretProperty);
|
||||||
$context.SetAutologin($userName, $password);
|
$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";
|
Write-EventLog -LogName Application -Source "Application" -EventId $EventID -Message "This event was created by $env:Username";
|
||||||
|
$context.Remove($AutoLoginTriggerProperty);
|
||||||
|
|
|
@ -9,11 +9,8 @@ param (
|
||||||
|
|
||||||
. "$PSScriptRoot/../../Scripts/Context.ps1";
|
. "$PSScriptRoot/../../Scripts/Context.ps1";
|
||||||
$context = [Context]::new();
|
$context = [Context]::new();
|
||||||
Unregister-ScheduledTask -Confirm:$false $AutoLoginTaskName;
|
|
||||||
Unregister-ScheduledTask -Confirm:$false $UACDisablerTaskName;
|
|
||||||
$context.SetUACState($false);
|
$context.SetUACState($false);
|
||||||
$context.Remove($AutoLoginTriggerProperty);
|
Unregister-ScheduledTask -Confirm:$false $UACDisablerTaskName;
|
||||||
|
Write-EventLog -LogName Application -Source "Application" -EventId $EventID -Message "This event was created by $env:Username";
|
||||||
$context.Remove($UACDisablerTriggerProperty);
|
$context.Remove($UACDisablerTriggerProperty);
|
||||||
$context.DeregisterNewUserReboot();
|
$context.DeregisterNewUserReboot();
|
||||||
Write-EventLog -LogName Application -Source "Application" -EventId $EventID -Message "This event was created by $env:Username";
|
|
||||||
Restart-Computer -Force;
|
|
Loading…
Reference in a new issue