Similar to the CreateComputerPowerOptionsPreferences, the Scheduled Tasks GPP have too many options to make it worthwhile to run through the Create_XML function. Additionally, these are likely rarely used and changed from environment to environment, so taking the time to setup a master Scheduled Tasks Preference will save time in the long run. To create a Scheduled Tasks GPP create a template GPP for the tasks that need to be deployed or modified and then copy the XML file into the script code and update a few options with needed variables.
The script contains the sample code to delete the default Adobe Flash Player Updater task. It is disabled by default.
Scheduled Tasks GPP Example
<?xml version=`"1.0`" encoding=`"utf-8`"?>`r
<ScheduledTasks clsid=`"{CC63F200-7309-4ba0-B154-A71CD118DBCC}`"><TaskV2 disabled =`"1`" clsid=`"{D8896631-B747-47a7-84A6-C155337F3BC8}`" name=`"Adobe Flash Player Updater`" image=`"3`" userContext=`"0`" removePolicy=`"0`" changed=`"$DateUni`" uid=`"$GUID`"><Properties action=`"D`" name=`"Adobe Flash Player Updater`" runAs=`"System`" logonType=`"InteractiveToken`"><Task version=`"1.3`"><RegistrationInfo><Author>Adobe Systems Incorporated</Author>`r
<Description>This task keeps your Adobe Flash Player installation up to date with the latest enhancements and security fixes. If this task is disabled or removed, Adobe Flash Player will be unable to automatically secure your machine with the latest security fixes.</Description></RegistrationInfo><Settings><Enabled>true</Enabled><ExecutionTimeLimit>PT1H</ExecutionTimeLimit><Hidden>false</Hidden>`r
<DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries><StopIfGoingOnBatteries>true</StopIfGoingOnBatteries><Priority>9</Priority><IdleSettings><Duration>PT1M</Duration><WaitTimeout>PT0S</WaitTimeout><StopOnIdleEnd>true</StopOnIdleEnd><RestartOnIdle>false</RestartOnIdle></IdleSettings>`r
<AllowStartOnDemand>false</AllowStartOnDemand><AllowHardTerminate>false</AllowHardTerminate><MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy></Settings><Principals><Principal id=`"Author`"><UserId>System</UserId><LogonType>InteractiveToken</LogonType><RunLevel>LeastPrivilege</RunLevel></Principal></Principals><Triggers><CalendarTrigger><Enabled>true</Enabled>`r
<Repetition><Interval>PT3600S</Interval><Duration>PT86400S</Duration><StopAtDurationEnd>false</StopAtDurationEnd></Repetition><StartBoundary>1999-12-31T19:21:00</StartBoundary><ScheduleByDay><DaysInterval>1</DaysInterval></ScheduleByDay></CalendarTrigger></Triggers><Actions><Exec>`r
<Command>C:\Windows\SysWOW64\Macromed\Flash\FlashPlayerUpdateService.exe</Command></Exec></Actions></Task></Properties></TaskV2></ScheduledTasks>
clsid is what identifies the type of task.
Basic Task - {2DEECB1C-261F-4e13-9B21-16FB83BC03BD}
Advanced Task - {D8896631-B747-47a7-84A6-C155337F3BC8}
Steps to create the XML file code for the script:
- Create a new GPO and identify the GUID and location on the SYSVOL.
- Edit the GPO and browse to Computer Configuration → Preferences → Control Panel Settings → Scheduled Tasks
- Create desired Scheduled Tasks

- Browse to network location of GPO
- Open in in a text editor, such as Notepad, and edit the following:
- Find changed and replace the date and time with:
$DateUni - Find uid and replace the GUID with:
$GUID - Find and replace all quotes “ with backtick quote `”
- Update any other options, such as description or targeting
- If the the Apply once and do not reapply. is selected find id and replace with
$GUID2
- Select all text and copy to clipboard
- Paste into
Function CreateComputerScheduledTasksPreferencesbetween the quotes on the Add-Content $ECScheduledTasksXMLFile line.
- Save and run script to confirm functionality
