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

17 lines
575 B
PowerShell

#!/bin/pwsh
param (
[int]$EventID,
[string]$AutoLoginTaskName,
[string]$UACDisablerTaskName,
[string]$AutoLoginTriggerProperty,
[string]$UACDisablerTriggerProperty
);
. "$PSScriptRoot/../../../Common/Scripts/Context.ps1";
$context = [Context]::new();
$context.SetUACState($false);
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.DeregisterNewUserReboot();