Oxygene34
Messages postés52Date d'inscriptionmardi 27 janvier 2009StatutMembreDernière intervention 4 avril 2009
-
13 mars 2009 à 21:55
Oxygene34
Messages postés52Date d'inscriptionmardi 27 janvier 2009StatutMembreDernière intervention 4 avril 2009
-
14 mars 2009 à 11:22
bonjour a tous...
j'ecris ce message car je galère en vbs sur "WMI Tasks: Scheduled Tasks"
mon probleme est que je n'arrive pas a configurer l'heure de déclanchement du programme a cause de UTC
je comprend l'anglais mais la je pense que c'est plutot une faute de calcul ou autre
il y a des indications en dessous du code
je sais que c'est long mais aider moi !!!!!!!
merci
voici le code:
_________________________________________________________________________________________________
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\" _
& strComputer & "\root\cimv2")
JobID = "Test"
Set objNewJob = objWMIService.Get("Win32_ScheduledJob")
errJobCreate = objNewJob.Create _
("Notepad.exe", "********143000.000000-420", _
True , 1 OR 4 OR 16, ,True, JobId)
If errJobCreate = 0 Then
WScript.Echo "Job created successfully: " & VBNewLine _
& "Notepad.exe scheduled to run repeately at 14.30 (2:30 P.M.) PST" & VBNewLine _
& "on Mon, Wed, and Fri."
Else
WScript.Echo "Job not created. Error code = " & errJobCreate
End If
In the string "********143000.000000-420" (used in the StartTime
parameter value of the Create method), "********143000.000000"
specifies that the task starts at 14.30 (2:30 P.M.) and "-420"
specifies the time zone. The time zone number is the current bias of
the local time translation. The bias is the difference between the
UTC time and the local time. To calculate the bias for your time zone,
multiply the number of hours that your time zone is ahead or behind
Greenwich Mean Time (GMT) by 60 (use a positive number for the number
of hours if your time zone is ahead of GMT and a negative number if
your time zone is behind GMT). Add an additional 60 to your
calculation if your time zone is using daylight savings time.
For example, the Pacific Standard Time zone is eight hours behind
GMT, therefore the bias is equals to -420 (-8 * 60 + 60)
when daylight savings time is in use and -480 (-8 * 60)
when daylight savings time is not in use. You can also determine the
value of the bias by querying the bias property of the
Win32_TimeZone class.
Oxygene34
Messages postés52Date d'inscriptionmardi 27 janvier 2009StatutMembreDernière intervention 4 avril 2009 14 mars 2009 à 09:09
mais j'ai déjà essaye plusiueurs fois. Normalement a paris c'est utc +1 donc 60+60=120 non? Donc si c'est ça on doit avoir pour que elle s'exécute a 16h donc ********160000.0000+120 c'est ça? Pouriez vous m'expliquer pourquoi on ne declanche pas simplement l'application a l'heure de l'ordinateur?
Duke49
Messages postés552Date d'inscriptionjeudi 12 octobre 2006StatutNon membreDernière intervention24 janvier 20234 14 mars 2009 à 10:13
Ton application ne doit pas être a usage local, voila pourquoi.
A la base WMI est justement là pour simplifier le temps mondial avec tous les providers pour des opérations composants ou pilotes. Au même moment avec le même code je réalise les mêmes choses n'importe ou.