Reputation: 1414
I am trying to use schtasks
to schedule a python GUI script. I want to delete a task once it has run. According to the documentation, I should be using the /Z
switch along with the /V1
switch. But this asks for a run-as password which I can't figure out how to provide.
The command that I am using is:
schtasks /create /sc once /tn task2 /tr "reminder i26" /sd 31/05/2017 /st
23:00 /V1 /Z /F
What is the solution to the problem?
Upvotes: 1
Views: 2724
Reputation: 11
I took a look at the doc below. It shows the /z switch as being valid to delete a scheduled task. Since you’re using “/sc once”, It may believe that no schedule exists since it’s running on demand. I get an xml error when trying /z on Windows 10 in a similar situation.
https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/schtasks
Upvotes: 1
Reputation: 1414
I solved the problem by allowing the use of blank passwords in all cases. As I am on Windows 7 Home Basic, there is no security policy editor (no secpol.msc). So I had to change the following registry setting -
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\limitblankpassworduse:
0x00000000
But it seems that the /z switch is not working - tasks are not getting automatically deleted on completion (at least not on windows 7 Home Basic).
Upvotes: 0