0

I wrote a batch file to run a schtasks for a Windows 7 Home machine. When I tested it in my account (standard user), the script runs correctly, but when I migrated the script to the account (also standard user, on the same computer) where it will be normally used, it would run properly until it came to the command schtasks /create ..., at which point it would display ERROR: Access is denied.

As far as I am able to tell, the settings on both accounts are the same - standard user, no admin privileges. (As schtasks works in one standard account, I can't understand why it is denying access.) The task that I am trying to create is an auto-logout feature, which only runs in the account that runs the script. The script in question lives on the desktop of each account. It may well be that the error is due to account settings, but I don't know how to figure that out.

2
  • "The script in question lives on the desktop of each account" - If you move the script to a common location, specifically a location both accounts have access to, does it work?
    – Ramhound
    Commented Mar 26 at 0:19
  • No, it still fails to Error: Access is denied. Commented Mar 27 at 22:19

1 Answer 1

0

The second user might not have the permission to Log on as a batch job:

This policy setting determines which accounts can sign in by using a batch-queue tool such as the Task Scheduler service.

An administrator may give the user this permission by:

  • Run gpedit.msc
  • Position to:
    Computer Configuration\Windows Settings\Security Settings\Local Policies\User Rights Assignment
  • Double-click "Log on as a batch job"
  • Add the user's account via "Add User or Group..."
  • Click OK.
2
  • Unfortunately, while this answer may work, it does not function for Windows 7 Home, which does not contain gpedit.msc. Commented Mar 26 at 0:11
  • On Windows Home you may use Policy Plus.
    – harrymc
    Commented Mar 26 at 9:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .