When running the command Register-ScheduledJob with even the most basic parameters, for example
Register-ScheduledJob -ScriptBlock {Get-Process} -Name Testing
I receive the following error:
writeErrorStream : True
PSMessageDetails :
Exception : System.Management.Automation.RuntimeException: A directory not found
error occurred while registering scheduled job definition testing.
Make sure you are running Windows PowerShell with elevated privileges.
---> Microsoft.PowerShell.ScheduledJob.ScheduledJobException: An error
occurred while registering scheduled job definition testing to the
Windows Task Scheduler. The Task Scheduler error is: The system cannot
find the path specified. (Exception from HRESULT: 0x80070003). --->
System.IO.DirectoryNotFoundException: The system cannot find the path
specified. (Exception from HRESULT: 0x80070003)
at TaskScheduler.ITaskService.GetFolder(String Path)
at Microsoft.PowerShell.ScheduledJob.ScheduledJobWTS.GetRootFolder()
at
Microsoft.PowerShell.ScheduledJob.ScheduledJobDefinition.AddToWTS()
at
Microsoft.PowerShell.ScheduledJob.ScheduledJobDefinition.Register()
--- End of inner exception stack trace ---
at
Microsoft.PowerShell.ScheduledJob.ScheduledJobDefinition.Register()
at Microsoft.PowerShell.ScheduledJob.RegisterScheduledJobCommand.Proc
essRecord()
--- End of inner exception stack trace ---
TargetObject : Microsoft.PowerShell.ScheduledJob.ScheduledJobDefinition
CategoryInfo : ObjectNotFound:
(Microsoft.Power...edJobDefinition:ScheduledJobDefinition)
[Register-ScheduledJob], RuntimeException
FullyQualifiedErrorId : DirectoryNotFoundWhenRegisteringScheduledJobDefinition,Microsoft.PowerSh
ell.ScheduledJob.RegisterScheduledJobCommand
ErrorDetails :
InvocationInfo : System.Management.Automation.InvocationInfo
ScriptStackTrace : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo : {0, 1}
What I've done:
I am running this from a fairly locked down environment. My guess is that there is a security policy that is stopping me from creating jobs from PowerShell
User contributions licensed under CC BY-SA 3.0