• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 496
  • Last Modified:

start scheduled task in .net

hi,

I'm triying to create a scheduled task from .net

Dim process1 As New System.Diagnostics.Process()
process1.StartInfo.FileName = "C:\WINDOWS\system32\schtasks.exe"
process1.StartInfo.Arguments = "/CREATE /TN ""name-of-task"" /TR name-of-program.exe /SC once /SD 02/11/2010 /ST 08:42:00 /TU system"
process1.Start()
process1.Close()

but the tast is not created, does any one have an idea?


                'System.Diagnostics.Process.Start("C:\WINDOWS\system32\schtasks.exe", "/CREATE /TN ""mailsender999"" /TR c:\program files\mailsender\mailsender.exe /SC once /SD 02/11/2010 /ST 08:42:00 /TU system")

                process1.Start()
                process1.Close()
0
reinoutkool
Asked:
reinoutkool
1 Solution
 
Éric MoreauSenior .Net ConsultantCommented:
0
 
reinoutkoolAuthor Commented:
got it to work with code below:

Dim process1 As New System.Diagnostics.Process()
process1.StartInfo.FileName = "schtasks"
process1.StartInfo.Arguments = "/CREATE /TN ""name-of-task"" /TR name-of-program.exe /SC once /SD 02/11/2010 /ST 08:42:00 /TU system"
process1.Start()
process1.Close()

will keep the class in mind, tnx
0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Tackle projects and never again get stuck behind a technical roadblock.
Join Now