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

19 lines
No EOL
694 B
PowerShell

#!/bin/pwsh
param (
[int]$EventID,
[string]$AutoLoginTaskName,
[string]$UACDisablerTaskName,
[string]$AutoLoginTriggerProperty,
[string]$UACDisablerTriggerProperty
);
. "$PSScriptRoot/../../Scripts/Context.ps1";
$context = [Context]::new();
Unregister-ScheduledTask -Confirm:$false $AutoLoginTaskName;
Unregister-ScheduledTask -Confirm:$false $UACDisablerTaskName;
$context.SetUACState($false);
$context.Remove($AutoLoginTriggerProperty);
$context.Remove($UACDisablerTriggerProperty);
$context.DeregisterNewUserReboot();
Write-EventLog -LogName Application -Source "Application" -EventId $EventID -Message "This event was created by $env:Username";
Restart-Computer -Force;