'Editing existing Group Policy using PowerShell

I have been created on my DC Group Policy which creates Schedule Task.

My question - How can I edit the command action inside the Schedule Task using PowerShell?



Solution 1:[1]

Do this via New-ScheduledTaskAction and Set-ScheduledTask

$action = New-ScheduledTaskAction -Execute 'PowerShell.exe' -Argument '-Command Example-Command'
Set-ScheduledTask -TaskName 'ExistingTaskName' -Action $action

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Slartiprefect