Sign in to follow this  
Followers 0
notta

Scheduling a task issue

3 posts in this topic

#1 ·  Posted (edited)

Is there something I'm doing wrong?

MsgBox(0,"","schtasks /create /sc hourly /tn Scan /mo 2 /sd " & $startDate & " /ed " & $endDate & " /tr " & $fileScanTool)
    $run = RunWait(@ComSpec & " /C schtasks /create /sc hourly /tn Scan /mo 2 /sd " & $startDate & " /ed " & $endDate & " /tr notepad.exe", @SW_HIDE)

I'm banging my head against the desk. If I type this command into a command prompt it works fine. The message box displays everything correctly, but it's not adding the task into the scheduler. Any ideas?

Edited by notta

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

@notta..What is the format of your date?

This works for me...Here you go...

$Username="someusername"
$Password="somepassword"

$startDate="09/17/2008"
$endDate="09/18/2008"

RunWait(@ComSpec & " /c " & 'schtasks /create /sc hourly /ru ' & $Username & ' /rp ' & $Password & ' /tn Scan /mo 2 /sd ' & $startDate & ' /ed ' & $endDate & ' /tr notepad.exe', "", @SW_HIDE)

:)

Edited by DjDeep00

Share this post


Link to post
Share on other sites

Thanks DJ. I forgot to put in the spacer for the workingdir parameter. Added the "" and it works fine now. Duh :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0