I am trying to get a list of scheduled tasks from within the task scheduler. Seemingly when you run the Get-ScheduledTask cmdlet it would appear to be hard coded to look within the C:\Windows\Tasks. However, I need to export a list of tasks from C:\Windows\System32\Tasks. I have tried specifying this task path and changed the file type to. job as it said this is the file type for Task Scheduler Task Object that also did not work. Below is the error I seem to get when looking for the specific file path:
No matching MSFT_ScheduledTask objects found by CIM query for instances of the Root/Microsoft/Windows/TaskScheduler/MSFT_ScheduledTask class on the CIM server: SELECT * FROM MSFT_ScheduledTask WHERE ((TaskName LIKE '%')) AND ((TaskPath LIKE 'C:\Windows\System32\Tasks\ADPhoneBookScript')). Verify query parameters and retry. At line:1 char:1
- Get-ScheduledTask -TaskName * -TaskPath "C:\Windows\System32\Tasks
I have tried many other fixes like moving to another folder in case of a permissions error but seemingly no joy.
Does anyone have any ideas?