|
Re: Agir sur le planificateur de tâches XP |
|
---|---|---|
Animateur WDF
Inscrit:
26/06/2002 16:24 De wdforge.org
Post(s): 2822
|
C'est rendu possible avec les WMI
Code à finir d'adapter du VB :
Origine de la ressouce
Contribution le : 09/03/2005 09:07
|
|
|
Re: Agir sur le planificateur de tâches XP |
|
---|---|---|
Stagiaire WDF
Inscrit:
17/10/2004 15:10 Post(s): 27
|
bonjour, et merci pour votre réponse cela m'a mis sur une piste et j'ai trouvé d'autres informations qui pourront peut être servir à quelqu'un d'autre plus qualifié que moi pour mettre en oeuvre cette tâche cela parle de class etc...
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_scheduledjob.asp http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/create_method_in_class_win32_scheduledjob.asp http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/wmi_tasks__dates_and_times.asp déjà l'anglais c pas évident mais la, en plus mon niveau débutant en windev c'est trop il n'y a vraiment pas assez d'exemples pour débutant en w-language sur le net ... c'est dommage un script en vbs permet aussi la création d'une tâche :
Bon il me reste plus qu'a trouver une solution plus facile à mettre en oeuvre.... je sent la galére
Contribution le : 10/03/2005 20:49
|
|
_________________
A bientôt |
||
|
Re: Agir sur le planificateur de tâches XP |
|
---|---|---|
Animateur WDF
Inscrit:
02/03/2003 04:07 De Noisy le grand(93)
Post(s): 2745
|
Bonjour,
WDForge met a votre disposition : Un article expliquant la manipulation d'objet systeme tel que WMI est disponible ici de meme qu'un projet exemple disponible ici
Contribution le : 11/03/2005 10:26
|
|
|
Re: Agir sur le planificateur de tâches XP |
|
---|---|---|
Utilisateur WDF
Inscrit:
22/03/2005 14:40 De Lyon Rhône France
Post(s): 51
|
Bonjour,
ci-après le code, qui fonctionne chez moi (WXP Fam) en wd8. -- global vf_c_NameSpace est une chaine = "\root\cimv2" LOCAL vl_c_command est une chaîne vl_c_StartTime est une chaîne vl_b_RunRepeatedly est un booléen vl_e_DaysOfWeek est un entier vl_e_DaysOfMonth est un entier vl_b_InteractWithDesktop est un booléen // Sablier(Vrai) vl_c_command = "Calc.exe" vl_c_StartTime = "********214000.000000-000" vl_b_RunRepeatedly = Vrai SI PAS vl_b_RunRepeatedly ALORS vl_e_DaysOfWeek = 0 SINON vl_e_DaysOfWeek = 1+2 FIN vl_e_DaysOfMonth = 1+2+4+8 vl_b_InteractWithDesktop = Vrai pf_Ajoute_Tache(vl_c_command,vl_c_StartTime,vl_b_RunRepeatedly,vl_e_DaysOfWeek,vl_e_DaysOfMonth,vl_b_InteractWithDesktop) Sablier(Faux) PROCEDURE pf_Ajoute_Tache(vv_c_Command,vv_c_StartTime,vv_b_RunRepeatedly,vv_e_DaysOfWeek,vv_e_DaysOfMonth,vv_b_InteractWithDesktop) // Infos sur http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/create_method_in_class_win32_scheduledjob.asp LOCAL ol_oad_objLocator est un objet Automation dynamique ol_oad_objService est un objet Automation dynamique ol_oad_objInstance est un objet Automation dynamique vl_v_errJobCreated est un Variant // retour info sur création de tâche vl_v_JobId est un Variant // identifiant de la tâche (en retour) // ol_oad_objLocator = allouer un objet Automation "WbemScripting.SWbemLocator" SI ol_oad_objLocator=Null ALORS Erreur(ErreurInfo()) GOTO Desallocation FIN ol_oad_objService=ol_oad_objLocator>>ConnectServer(".", vf_c_NameSpace, Null, Null) SI ol_oad_objService=Null ALORS Erreur(ErreurInfo()) GOTO Desallocation FIN //ol_oad_objService>>Security_>>ImpersonationLevel =3 ol_oad_objInstance=ol_oad_objService>>Get("Win32_ScheduledJob") SI ol_oad_objInstance=Null ALORS Erreur(ErreurInfo()) GOTO Desallocation FIN vl_v_errJobCreated= ol_oad_objInstance>>Create(vv_c_Command ,vv_c_StartTime ,vv_b_RunRepeatedly, vv_e_DaysOfWeek,vv_e_DaysOfMonth ,vv_b_InteractWithDesktop, vl_v_JobId) //Return code Description //0 The request is accepted. //1 The request is not supported. //2 The user does not have the necessary access. //8 Interactive Process. //9 The directory path to the service executable file cannot be found. //21 Invalid parameters have been passed to the service. //22 The account that this service runs under is invalid or lacks the permissions to run the service. SELON vl_v_errJobCreated CAS 0 //The request is accepted. CAS 1 //The request is not supported. CAS 2 //The user does not have the necessary access. CAS 8 //Interactive Process. CAS 9 //The directory path to the service executable file cannot be found. CAS 21 //Invalid parameters have been passed to the service. CAS 22 //The account that this service runs under is invalid or lacks the permissions to run the service. AUTRE CAS // Cas pas décrit par microsoft au 23 mars 2005 FIN Desallocation: // Libérer les camarades SI ol_oad_objLocator<>Null ALORS libérer(ol_oad_objLocator) SI ol_oad_objService<>Null ALORS libérer(ol_oad_objService) SI ol_oad_objInstance<>Null ALORS libérer(ol_oad_objInstance)
Contribution le : 25/03/2005 13:45
|
|
Vous ne pouvez pas débuter de nouveaux sujets.
Vous pouvez voir les sujets.
Vous ne pouvez pas répondre aux contributions.
Vous ne pouvez pas éditer vos contributions.
Vous ne pouvez pas effacez vos contributions.
Vous ne pouvez pas ajouter de nouveaux sondages.
Vous ne pouvez pas voter en sondage.
Vous ne pouvez pas attacher des fichiers à vos contributions.
Vous ne pouvez pas poster sans approbation.