Hi, I am attempting to create a scheduled task on multiple systems using a script. The task needs to run 2 minutes from the current time on the computer, regaurdless of if the time is correct or not. This will need to run on XP, Vista, 7 and Windows 8.
I have figured out windows Vista, 7 and 8, but it seems like XP needs a bit more. Below is a script I have been testing, it will run through the script, and I have it make a string, which I then run, but does not make the task. I have it output to a MsgBox, and it seems like the string for the command is correct.
Anyone have any ideas?
$h = @HOUR
$m = @MIN
$m = $m + 5
If $m == 60 Then
$m = "00"
$h = $h + 1
ElseIf $m == 61 Then
$m = "01"
$h = $h + 1
ElseIf $m == 62 Then
$m = "02"
$h = $h + 1
ElseIf $m == 63 Then
$m = "03"
$h = $h + 1
ElseIf $m == 64 Then
$m = "04"
$h = $h + 1
ElseIf $m == 65 Then
$m = "05"
$h = $h + 1
Else
$m = $m
EndIf
Run("SchTasks /Delete /TN /f 'DHCDScript'")
$scTas = "schtasks /create /sc minute /mo 5 /tn DHCDScript /tr '" & $sFldr1 & "\clean2.exe' /st " & $h & ":" & $m & ":00 /p '" & $unpass & "'" ;/u '" & @ComputerName & "\" & @UserName & "'"
Run($scTas)