Scheduling a PowerShell script on a Windows 10 Home notebook

Marius - Roma 391 Reputation points
2020-11-23T10:14:40.183+00:00

I created a PowerShell script and a scheduled task to run it every few minutes.
It works ok on my desktop PC Windows 10 Pro.
I scheduled it in the same way on my Windows 10 Home notebook and I get the return code 2147942401.
Is there any limitation in scheduling a PowerShell script in a Windows 10 Home PC?
If not, how can I troubleshoot the problem?
Regards

Windows for business Windows Client for IT Pros User experience Other
0 comments No comments
{count} votes

4 answers

Sort by: Most helpful
  1. Andreas Baumgarten 123.4K Reputation points MVP Volunteer Moderator
    2020-11-23T12:04:58.67+00:00

    In which user context the scheduled task and the PowerShell script are executed?
    Does this user have the right "Log on as batch job" on the Windows 10 Home PC?

    Btw. if you convert the decimal 2147942401in hex you get 80070001 and the error code 0x80070001 means Incorrect function or Illegal function.


    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards
    Andreas Baumgarten

    1 person found this answer helpful.
    0 comments No comments

  2. Anonymous
    2020-11-24T07:41:40.767+00:00

    Hi,

    1. May I know how you schedule your task? Could you please share some screenshots of settings in task scheduler?
    2. Does the user you selected to run the task has the right "Log on as a batch job" and "Log on as a service"?
      Computer configuration-> Policies-> Windows Settings-> Security Settings-> Local Policies-> User Rights Assignment-> Logon as a batch job\Log on as a service
      42035-image.png
      42115-image.png
    3. Can you share the error message? Or you can check the event logs to see if there is any clue.
      Event Viewer\Applications and Services Logs\Microsoft\Windows\TaskScheduler

    Thanks,
    Eleven

    ----------

    If the Answer is helpful, please click "Accept Answer" and upvote it. Thanks.

    1 person found this answer helpful.
    0 comments No comments

  3. Marius - Roma 391 Reputation points
    2020-11-24T17:03:22.45+00:00

    Many thanks for the answers.
    I suspect that you are both right, but in Windows 10 Home I don't see any way to assign the user right "Logon as a batch job": is there any way to solve the issue, maybe tweaking the Registry?
    Regards
    marius

    0 comments No comments

  4. Andreas Baumgarten 123.4K Reputation points MVP Volunteer Moderator
    2020-11-24T17:21:14.797+00:00

    The gpedit.msc is missing on Windows 10 Home?

    Maybe this is helpful: https://www.itechtics.com/enable-gpedit-windows-10-home/


    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards
    Andreas Baumgarten

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.