TaskScheduler | R Documentation |
An R6 class for creating and checking a task call and wrappers
schtasks_run( task_name, system = NULL, username = NULL, password = NULL, quiet = FALSE ) schtasks_end( task_name, system = NULL, username = NULL, password = NULL, quiet = FALSE ) schtasks_create( task_name, system = NULL, username = NULL, password = NULL, runas_username = NULL, runas_password = NULL, schedule = NULL, modifier = NULL, days = NULL, months = NULL, idle_time = NULL, task_run = NULL, start_time = NULL, interval = NULL, end_time = NULL, duration = NULL, terminate = FALSE, start_date = NULL, end_date = NULL, channel_name = NULL, delete_after_final = FALSE, v1 = FALSE, force = FALSE, level = c("limited", "highest"), delay_time = NULL, quiet = FALSE ) schtasks_create_xml(xml_file) schtasks_delete( task_name, system = NULL, username = NULL, password = NULL, force = FALSE, quiet = FALSE ) schtasks_query( system = NULL, username = NULL, password = NULL, format = c("csv", "list", "table"), no_header = FALSE, verbose = FALSE, raw = FALSE, xml_type = NULL, quiet = FALSE ) schtasks_change( task_name, system = NULL, username = NULL, password = NULL, runas_username = NULL, runas_password = NULL, task_run = NULL, start_time = NULL, interval = NULL, end_time = NULL, duration = NULL, terminate = FALSE, start_date = NULL, end_date = NULL, level = NULL, enable = TRUE, disable = FALSE, delete_after_final = FALSE, delay_time = NULL, quiet = FALSE ) schtasks_showsid(task_name, convert = TRUE)
task_name |
The path/name of the task to run now |
system |
The remote system to connect to |
username |
The user context under which the |
password |
The password for the given user context |
quiet |
If |
runas_username |
The "run as" user account (user context) under which
the tasks runs. For the system account, valid values are |
runas_password |
The password for the "run as" user. |
schedule |
The schedule frequency. Valid schedule types are : |
modifier |
Refines the schedule type to allow finer control over
schedule recurrence. See section |
days |
The day of the week to run the task. Can be either the name of
the week (or an abbreviation). If |
months |
The month(s) of the year. Defaults to the first of the month.
Can use either the whole month ( |
idle_time |
The amount of idle time to wait before running a task. Only
valid for schedule |
task_run |
A string in the form of the |
start_time |
The start time to run the task. Time format is |
interval |
The repetition interval in minutes. Only applicable for
|
end_time |
The end time to run the task. The time format is |
duration |
The duration to run the task. The time format is |
terminate |
If |
start_date |
The first date on which the task runs. Not applicable for
schedules |
end_date |
end_date The last date on which the task runs. Not applicable
for schedules |
channel_name |
The event channel for |
delete_after_final |
If |
v1 |
If |
force |
If |
level |
The run level for the job, either |
delay_time |
The wait time to delay the running of the task after the
trigger is fired. Time format is |
xml_file |
A path to a |
format |
The format for the output. One of: |
no_header |
If |
verbose |
If |
raw |
If |
xml_type |
Displays the task definitions in XML format. If |
enable |
If |
disable |
If |
convert |
Converts the output (currently only valid for |
Commands are passed using base::system2()
Wrappers for R6 object creation and command execution:
schtasks_run()
Runs a scheduled task on demand
schtasks_end()
Stops a currently running scheduled task
schtasks_create()
Create a scheduled tasks on a local or remote system
schtasks_delete()
Deletes a scheduled task
schtasks_query()
Displays the scheduled tasks on the local or
remote system. Returns a tibble
schtasks_change()
Changes the program to run, or user account and password used by a scheduled task
schtasks_showsid()
Shows the security identifier corresponding to a scheduled task name
Valid values for the modifiers are as follows:
monthly
1 - 12 or "first", "second", "third", "fourth", "last", or "last_day"
weekly
weeks 1 - 52
minute
1 - 1439 minutes
daily
1 - 365 days
hourly
1 - 23 hours
once
nothing
on_start
nothing
on_logon
nothing
on_idle
nothing
on_event
XPath event query string
schtasks.exe
These functions specifically make it easier to an R user on Windows to
interact with the
Schtasks.exe
applications. Note that successful use of Schtasks.exe
required Administrative privledged and should be run as an administrator. This will likely be an issue if the user is using Rstudio
result
The the the call
system_call
The system call of the function
exec
Should schtasks.exe be executed? For testing purposes only.
new()
Initializes the call
TaskScheduler$new( task_name = NULL, system = NULL, username = NULL, password = NULL, runas_username = NULL, runas_password = NULL, schedule = c("once", "minute", "hourly", "daily", "weekly", "monthly", "onstart", "onlogon", "onidle", "onevent"), modifier = NULL, days = NULL, months = NULL, idle_time = NULL, task_run = NULL, start_time = NULL, interval = NULL, end_time = NULL, duration = NULL, terminate = FALSE, start_date = NULL, end_date = NULL, channel_name = NULL, delete_after_final = FALSE, v1 = FALSE, force = FALSE, level = c("limited", "highest"), delay_time = NULL, xml_file = NULL, format = c("csv", "list", "table"), no_header = FALSE, verbose = FALSE, xml_type = NULL, raw = FALSE, enable = FALSE, disable = FALSE, env = "", convert = TRUE, quiet = FALSE, exec = TRUE )
env
character vector of name=value strings to set environment
variables (passed to base::system2()
)
exec
If FALSE
will not run base::system2()
run()
Runs schtasks run
TaskScheduler$run()
end()
Runs schtasks end
TaskScheduler$end()
create()
Runs schtasks create
TaskScheduler$create()
create_xml()
creates a task using an xml file, a special variant for
schtasks create
TaskScheduler$create_xml()
delete()
Runs schtasks delete
TaskScheduler$delete()
query()
Runs schtasks query
TaskScheduler$query()
change()
Runs schtasks change
TaskScheduler$change()
show_sid()
Runs schtasks showsid
check days
check months
check idle_time
TaskScheduler$show_sid()
clone()
The objects of this class are cloneable with this method.
TaskScheduler$clone(deep = FALSE)
deep
Whether to make a deep clone.
## Not run: # These are recreations of the examples from the cmd help documents. These # are nonsensical. # Creates a scheduled task # Creates a scheduled task "doc" on the remote machine "abc" which runs # notepad.exe every hour under user "runasuser" schtasks_create( system = "abc", username = "user", password = "password", runas_username = "unasuer", runas_password = "runaspassword", schedule = "hourly", task_name = "doc", task_run = "notepad" ) # Change a task schtasks_change( password = "password", task_name = "/Backup/Backup and Restore" ) schtasks_change( task_run = "restore.exe", task_name = "/Backup/Start Restore" ) schtasks_change( system = "system", username = "user", password = "password", runas_username = "newuser", task_name = "/Backup/Start Backup" ) # Query a task schtasks_query( system = "system", username = "user", password = "password" ) schtasks_query( format = "list", verbose = TRUE, system = "system", username = "user", password = "password" ) schtasks_query( format = "table", no_header = TRUE, verbose = TRUE ) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.