Nick Radtke
Nick Radtke

Reputation: 66

scheduled task onlogon repeat

I need to set a Windows scheduled task that runs at logon and repeats at a given interval (say hourly for this case).

Basically, I want to do this via command line: https://dl.dropbox.com/u/19514611/Capture.PNG

Microsoft's schtasks.exe page (found here: http://msdn.microsoft.com/en-us/library/windows/desktop/bb736357%28v=vs.85%29.aspx) seems to imply you can't set any repetition for an ONLOGON event via command line, but can via the wizard. Is this accurate?

EDIT:

After further research, I've found that I can export this configuration as an XML and build the task using the xml. Is this the way I should go about this? It will require something to parse out and generate a new xml file for each user (less than ideal) and I'd much rather do this via command line.

Upvotes: 2

Views: 5906

Answers (2)

Scot
Scot

Reputation: 51

I realize this thread is old but recently ran into the same issue. The trick is to run a change command after the initial create command. The following will change the task to run every 1 minute.

SCHTASKS.exe /Create /SC ONLOGON /TN "Your Task Name" /TR "c:\path\executableoftask.exe" /RU SomeUser /RP SomePassword

SCHTASKS.exe /Change /RI 1 /TN "Your Task Name" /RU SomeUser /RP SomePassword

Upvotes: 5

coneH34D
coneH34D

Reputation: 97

SCHTASKS /CREATE /U username /P password /SC ONLOGON /TN "Your Task Name" /TR c:\path\executableoftask.exe /RI HOURLY

Upvotes: -1

Related Questions