Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
WMI Service
Message
De
26/12/2008 15:59:07
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
WMI Service
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2000 Server
Divers
Thread ID:
01369792
Message ID:
01369792
Vues:
56
I am attempting to write a application that will monitor the Scheduled Task on a pc. The application will run on the pc itself and write to a log file. The trouble I'm having is trying to pull out all the information that I know your supposed to be able to access through the WMI Service for scheduled task. The object that I set to hold this info always returns a count of zero so its as if it can't read from the scheduled tasks on my pc.

Any help is greatly appreciated. Thanks


Below is some sample code I'm using:
strComputer = "."
objWMIService = GetObject("winmgmts:" + "{impersonationLevel=impersonate}!\\" + strComputer + "\root\cimv2")
colScheduledJobs = objWMIService.ExecQuery("Select * from Win32_ScheduledJob")


FOR EACH objJob IN colScheduledJobs

	job_cpt     = objJob.Caption		&& Job Caption
	job_cmd     = objJob.Command		&& Job Command
	job_mth     = objJob.DaysOfMonth		&& Days Of Month
	job_wk      = objJob.DaysOfWeek		&& Days Of Week
	job_desc    = objJob.Description		&& Job Description
	job_elap    = objJob.ElapsedTime		&& Elapsed Time
	job_inst    = objJob.InstallDate		&& Install Date
	job_int     = objJob.InteractWithDesktop	&& Interact With Desktop
	job_id      = objJob.JobID		&& Job ID
	job_jobstat = objJob.JobStatus		&& Job Status
	job_name    = objJob.Name		&& Job Name
	job_notify  = objJob.Notify		&& Job Notify
	job_owner   = objJob.Owner		&& Job Owner
	job_pri     = objJob.Priority		&& Job Priority
	job_repeat  = objJob.RunRepeatedly	&& Run Repeatedly
	job_start   = objJob.StartTime		&& Start Time
	job_stat    = objJob.Status		&& Status
	job_submit  = objJob.TimeSubmitted	&& Time Submitted
	job_end     = objJob.UntilTime		&& Until Time
	
NEXT
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform