I was trying to run TrackGpo from the Windows Task Scheduler by executing the following:
Program/Script: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
Parameter: -ExecutionPolicy Bypass -Command "Invoke-GpoTracking -GpoRepo C:\GPO_Repo -WorkingDir C:\GPO_WorkingDir"
Running the task resulted in the following error:
Task Scheduler successfully completed task "\Backup GPOs" , instance "{300bfea1-ba81-4a4a-9350-205a9fd27d76}" , action "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" with return code 2147942401.