question

mariusroma avatar image
0 Votes"
mariusroma asked mariusroma answered

Windows 10 Home, scheduled task

I have 2 PCs, one Windows 10 Pro and one Windows 10 Home.
I created a PowerShell script to check the battery status and the network connection and I want to execute it every 5 minutes on each PC.
On the Windows 10 Pro PC I can create a scheduled task and it works fine.
On the Windows 10 Home PC I create the same scheduled task but each time it runs I get return code 2147942401.
After investigating the problem it looks that the user used to run the scheduled task is missing the right to logon as a batch job.
Is there any other explaination of the problem?
Unfortunately, Windows 10 Home does not include secpol.msc neither gpedit.msc.
How can I make my script run as a scheduled task on Windows 10 Home?
Regards
marius

windows-10-general
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

CarlFan-MSFT avatar image
1 Vote"
CarlFan-MSFT answered

Hi,
According to the error code, In order to fill this you should open your schedule task and then right-click to open properties window. Navigate to actions tab and then click edit. When you open it you’ll realize it’s not filled and you need to fill in the path to your batch file. This is related to task scheduler error code 2147942401 which is also the same as 0x80070001.
Meanwhile, please check the steps below if it works.
https://superuser.com/questions/1172540/task-scheduler-task-completed-successfully-with-exit-code-0x8007001?rq=1
Hope this helps and please help to accept as Answer if the response is useful.
Best Regards,
Carl

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Castorix31 avatar image
1 Vote"
Castorix31 answered

Have you tried with the recommendations from Windows Task Scheduler: Configure to run a PowerShell Script
(like -ExecutionPolicy Bypass)



5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

mariusroma avatar image
0 Votes"
mariusroma answered

Many thanks for the answer and the usefull pointer.
It's the way it works on my Windows 10 Pro PC.
The same settings on my Windows 10 Home PC produce return code 2147942401.
Is there any way to avoid it?
Regards
marius

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

mariusroma avatar image
0 Votes"
mariusroma answered

Thank you for your suggestion.
My analysis was wrong, the problem did not depend on the Windows 10 Home version but on an incorrect script path.
After moving the script to a different path (without spaces in the folder names), the scheduled task is working properly.
Regards
marius

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.