Home All Groups Group Topic Archive Search About

creating a scheduled task.

Author
6 Jul 2006 9:34 AM
Neil
Hi,
I am having problems in trying to create a scheduled task from within
in application that carries out a health check on a client. I am using
VS 2005.

When the program runs it  flashes a command prompt but does nothing.

Dim task As New System.Diagnostics.ProcessStartInfo("schtasks /create
/tn ""Test2"" /tr C:\WINDOWS\system32\calc.exe /sc daily /st 15:14:00
/ru ""System""")
System.Diagnostics.Process.Start(task)

Any help will be gratefully received
Neil.

Author
6 Jul 2006 3:14 PM
Jared Parsons [MSFT]
Hello Neil,

> Hi,
> I am having problems in trying to create a scheduled task from within
> in application that carries out a health check on a client. I am using
> VS 2005.
> When the program runs it  flashes a command prompt but does nothing.
>
> Dim task As New System.Diagnostics.ProcessStartInfo("schtasks /create
> /tn ""Test2"" /tr C:\WINDOWS\system32\calc.exe /sc daily /st 15:14:00
> /ru ""System""")
> System.Diagnostics.Process.Start(task)
> Any help will be gratefully received Neil.

Is the application running as a non-administrator?  If so this won't work
because you have to be an admin to run schtasks.

Otherwise what is the return code of schtasks?

--
Jared Parsons [MSFT]
jared***@online.microsoft.com
All opinions are my own. All content is provided "AS IS" with no warranties,
and confers no rights.
Author
7 Jul 2006 9:29 AM
Neil
Jared wrote:
Show quoteHide quote
> Hello Neil,
>
> > Hi,
> > I am having problems in trying to create a scheduled task from within
> > in application that carries out a health check on a client. I am using
> > VS 2005.
> > When the program runs it  flashes a command prompt but does nothing.
> >
> > Dim task As New System.Diagnostics.ProcessStartInfo("schtasks /create
> > /tn ""Test2"" /tr C:\WINDOWS\system32\calc.exe /sc daily /st 15:14:00
> > /ru ""System""")
> > System.Diagnostics.Process.Start(task)
> > Any help will be gratefully received Neil.
>
> Is the application running as a non-administrator?  If so this won't work
> because you have to be an admin to run schtasks.
>
> Otherwise what is the return code of schtasks?
>
> --
> Jared Parsons [MSFT]
> jared***@online.microsoft.com
> All opinions are my own. All content is provided "AS IS" with no warranties,
> and confers no rights.

Hi Jared,
I had the application running as a non-administrator but  schtasks
still does not return an error code.
thank you for help
Neil
Author
9 Jul 2006 3:09 PM
Eric Moreau
See an article I wrote in August 2004 from http://emoreau.s2i.com/. A
wrapper for the scheduled task is available for download.

--


HTH

Éric Moreau, MCSD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
S2i web inc. (www.s2i.com)
http://emoreau.s2i.com/

Show quoteHide quote
"Neil" <neil***@gmail.com> wrote in message
news:1152178494.649138.192680@b68g2000cwa.googlegroups.com...
> Hi,
> I am having problems in trying to create a scheduled task from within
> in application that carries out a health check on a client. I am using
> VS 2005.
>
> When the program runs it  flashes a command prompt but does nothing.
>
> Dim task As New System.Diagnostics.ProcessStartInfo("schtasks /create
> /tn ""Test2"" /tr C:\WINDOWS\system32\calc.exe /sc daily /st 15:14:00
> /ru ""System""")
> System.Diagnostics.Process.Start(task)
>
> Any help will be gratefully received
> Neil.
>
Author
10 Jul 2006 1:31 PM
Neil
Hi Éric,
this is just what I was looking for, thank you very much.
Neil


Eric Moreau wrote:
Show quoteHide quote
> See an article I wrote in August 2004 from http://emoreau.s2i.com/. A
> wrapper for the scheduled task is available for download.
>
> --
>
>
> HTH
>
> Éric Moreau, MCSD, Visual Developer - Visual Basic MVP
> Conseiller Principal / Senior Consultant
> S2i web inc. (www.s2i.com)
> http://emoreau.s2i.com/
>
> "Neil" <neil***@gmail.com> wrote in message
> news:1152178494.649138.192680@b68g2000cwa.googlegroups.com...
> > Hi,
> > I am having problems in trying to create a scheduled task from within
> > in application that carries out a health check on a client. I am using
> > VS 2005.
> >
> > When the program runs it  flashes a command prompt but does nothing.
> >
> > Dim task As New System.Diagnostics.ProcessStartInfo("schtasks /create
> > /tn ""Test2"" /tr C:\WINDOWS\system32\calc.exe /sc daily /st 15:14:00
> > /ru ""System""")
> > System.Diagnostics.Process.Start(task)
> >
> > Any help will be gratefully received
> > Neil.
> >