One Day Sec

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.
PowerShellNew-GPONew-GPLinkBackup-GpoImport-GPOscheduled taskGPO command line

Browse all Q&A →