D
D
dwordf2021-10-08 09:15:13
PowerShell
dwordf, 2021-10-08 09:15:13

Why is the task scheduler throwing an error?

Task execution error 0xFFFD0000

$Path = "C:\1"
$files =( Get-ChildItem $Path -Recurse -include *.* | Where { $_.Exists } )                                                                      
  Send-MailMessage -from [email protected]ДОМЕН -to [email protected]ДОМЕН -Subject 'New File' -SmtpServer СМТП_СЕРВЕР -Attachments $files.PSPath  
  Remove-Item $Path\* -Recurse -Force


smtp without authorization. I run the script manually and everything works, but not in the task.
615fe163e14bf999281938.png

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
Roman Bezrukov, 2021-10-08
@dwordf

add "-ExecutionPolicy Bypass" to the arguments
or use -command "&'path to script' -scriptparameter"
instead of -file "path to script " (this is how scripts work in the scheduler for me)

V
Vladimir, 2021-10-08
@FluffyBeaver

The error is very likely unrelated to the contents of the script.
It is most likely that the problem occurs when parsing program startup arguments.
You need to check the task launch parameters, and then check that the script is available with these parameters (on whose behalf, for example, it is executed).
PS - I think some of the tags (Powershell and mail) are superfluous here :)
PPS - I think if you drive the error code into Google, you can find a description of the error among the already traditional garbage.

R
Ronald McDonald, 2021-10-08
@Zoominger

Try to leave only "powershell.exe" in "Program or script".

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question