How can you create a GPO with a scheduled task using only PowerShell commands?
First, create the GPO with `New-GPO -Name TestGPO1`, then link it to the domain with `New-GPLink -Name TestGPO1 -Target 'dc=test,dc=com'`. To add a scheduled task, you must back up the GPO using `Backup-Gpo`, manually create the `ScheduledTasks.xml` file in the backup, modify `Backup.xml` and `gpreport.xml`, and finally restore the GPO with `Import-GPO`. An open‑source script, `New-GPOImmediateTask`, automates these steps. More detail is provided in the [companion command‑line article](/news/domain-penetration-remote-execution-via-scheduled-tasks-in-gpo-command-line-implementation-principles-and-script-details).
Related article:
Domain Penetration - Remote Execution via Scheduled Tasks in GPO