UTC time to run the job, in the form of "YYYYMMDDHHMMSS.MMMMMM(+-)OOO", where "YYYYMMDD" must be replaced by "********". The replacement is necessary because the scheduling service only allows jobs to be configured to run one time, or run on a day of the month or week. A job cannot be run on a specific date.
Donc j'ai contourné le problème comme cela :
Dim uneDate
Dim mTab
Dim paramMois
Dim paramTask
uneDate = FormatDateTime(DateSerial(Year(Date),Month(Date)+1,1)-1,vbShortDate)
Wscript.Echo "Voici le dernier jour du mois : " & uneDate
mTab = Split(Cstr (uneDate), "/")
paramMois = mtab(1)
Select Case paramMois
Case 31
paramTask = 1073741824
Case 30
paramTask = 536870912
Case 29
paramTask = 268435456
Case 28
paramTask = 134217728
Case Else
Wscript.Echo "False and close the programme"
Wscript.quit
End Select
strComputer = "."
Set objService = GetObject("winmgmts:\" & strComputer)
Set objNewJob = objService.Get("Win32_ScheduledJob")
errJobCreated = objNewJob.Create _
("Monitor.exe", "********123000.000000-420", _
False , , paramTask, , JobID)
If Err.Number = 0 Then
Wscript.Echo "New Job ID: " & JobID
Else
Wscript.Echo "An error occurred: " & errJobCreated
End If
Je pense qu'il est possible d'optimiser le code, mais en tout cas ça marche :)!!! Il ne restera plus qu'a supprimer les tâches planifié qui se sont déjà exécuté.
Dim uneDate
Dim mTab
Dim final
uneDate = FormatDateTime(DateSerial(Year(Date),Month(Date)+1,1)-1,vbShortDate)
mTab = Split(Cstr (uneDate), "/")
final = (mTab(2)+mTab(1)+mTab(0))
strComputer = "."
Set objService = GetObject("winmgmts:\" & strComputer)
Set objNewJob = objService.Get("Win32_ScheduledJob")
errJobCreated = objNewJob.Create _
("Notepad.exe", final & "123000.000000-420", _
False , , , , JobID)
If Err.Number = 0 Then
Wscript.Echo "New Job ID: " & JobID
Else
Wscript.Echo "An error occurred: " & errJobCreated
End If
Mais je n'arrive pas à créer ma tâche le 31/03/13 uniquement..
J'ai même testé en dur via 20130331123000.000000-420 ( via les explications de Microsoft Tapez le texte de l'url ici.