by XDK
5. February 2017 21:42
Exception:
PS D:\> Start-ScheduledTask -TaskName SynchronizeTime
Start-ScheduledTask : The system cannot find the file specified.
At line:1 char:1
+ Start-ScheduledTask Update-MyHelp -Starttings $s
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (PS_ScheduledTask:Root/Microsoft/…S_ScheduledTask) [Start-ScheduledTask]
, CimException
+ FullyQualifiedErrorId : HRESULT 0x80070002,Start-ScheduledTask
Explanation:
I got the above exception while working with Scheduled Task Cmdlets in Windows PowerShell.
Solution:
Adding TaskPath parameter resolved the issue.
PS D:\> $path = (Get-ScheduledTask SynchronizeTime).TaskPath
PS D:\> Start-ScheduledTask -TaskName SynchronizeTime -TaskPath $path
430da675-6c65-4636-91d9-9e826b148d84|4|4.0|96d5b379-7e1d-4dac-a6ba-1e50db561b04
Tags:
VNext Builds | PowerShell