Mute console output

This commit is contained in:
Manuel Thalmann 2023-06-28 12:35:06 +02:00
parent 20d58b32d1
commit 54d80b4bb5

View file

@ -45,7 +45,7 @@ function Enable-UACNextLogin() {
$taskName = "PortValhalla"
$keyPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System";
$propertyName = "EnableLUA";
Set-ItemProperty "$keyPath" -Name "$propertyName" -Value 1;
$null = Set-ItemProperty "$keyPath" -Name "$propertyName" -Value 1;
$action = New-ScheduledTaskAction -Execute "pwsh.exe" -Argument ("-c " + `
"Set-ItemProperty `"$keyPath`" -Name `"$propertyName`" -Value 0;" + `
@ -53,5 +53,5 @@ function Enable-UACNextLogin() {
$trigger = New-ScheduledTaskTrigger -AtLogOn;
$principal = New-ScheduledTaskPrincipal -UserId "SYSTEM" -RunLevel Highest;
$task = New-ScheduledTask -Action $action -Principal $principal -Trigger $trigger;
Register-ScheduledTask $taskName -InputObject $task;
$null = Register-ScheduledTask $taskName -InputObject $task;
}