Jump to content

Recommended Posts

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
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

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...