Task Scheduling
It's recommended you create user for the tasks. Perhaps PointlessTasks. Then you can use your own password for this. This ensures the task can run with no one logged in, and if someone changes their own password the task continues to run.
Place the file in a common tasks folder, we provide one below. Then follow the instructions here:
Here’s how to set that PowerShell script to run daily at 2 AM using Task Scheduler:
- Open Task Scheduler (
taskschd.mscfrom Run or Start Menu). - In the right-hand pane, click Create Task.
- General tab:
Name: Anything likeAutoCloseScript.
Run whether user is logged on or not.
Check Run with highest privileges.
Choose Windows 10/11 in the "Configure for" dropdown (if applicable). - Triggers tab:
Click New.
Begin the task: On a schedule.
Daily.
Start: set the date and time to 2:00:00 AM.
Click OK. - Actions tab:
Click New.
Action: Start a program.
Program/script:powershell.exeAdd arguments:-ExecutionPolicy Bypass -File "C:\pointless\scheduledTasks\autoClose.ps1"Click OK. - Conditions and Settings tabs: Optional tweaks (e.g., uncheck "Start only if on AC power").
- Click OK, enter admin credentials if prompted.
That’s it. The task will run daily at 2 AM. Want the same thing done via command line instead?
4oYou said:We got a message that says 'The task rquires that the user account specified has log on as batch job rights. ChatGPT said:
That error means the user account you're assigning to the task doesn't have "Log on as a batch job" rights, which is required to run scheduled tasks when the user isn't logged in.
Here’s how to fix it:
Grant “Log on as a batch job” rights:
- Open Local Security Policy (
secpol.mscfrom Start or Run dialog). - Go to:
Local Policies→User Rights Assignment. - Find Log on as a batch job.
- Double-click it → click Add User or Group.
- Add the user account you're using for the scheduled task.
- Click OK and close out.
If
secpol.mscis not available (e.g., on Home editions), you’ll need to use Group Policy or adjust it via the registry or with a tool likentrights.exefrom the Windows Server 2003 Resource Kit.
After doing this, go back to Task Scheduler and try to run the task again.
Need the command-line way to assign this right?
4o