Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Server > Scripting > VBScript for WMI listing of scheduled tasks?

Reply
Thread Tools Display Modes

VBScript for WMI listing of scheduled tasks?

 
 
Jason
Guest
Posts: n/a

 
      09-10-2008
I'm trying to list the scheduled tasks on a Win Server 2008 64-bit machine.
But running the following script produces no results (or errors):

strComputer = "."

set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
set colScheduledJobs = objWMI.ExecQuery("Select * from Win32_ScheduledJob")
for each objJob in colScheduledJobs
MsgBox objJob.Name
next
 
Reply With Quote
 
 
 
 
Masterplan
Guest
Posts: n/a

 
      09-11-2008
Hi Jason,

The Win32_ScheduledJob WMI class represents a job created with the AT
command. The Win32_ScheduledJob class does not represent a job created with
the Scheduled Task Wizard from the Control Panel. That's why it produce no
results.

--
Have a nice day!

http://winmasterplan.blogspot.com


"Jason" wrote:

> I'm trying to list the scheduled tasks on a Win Server 2008 64-bit machine.
> But running the following script produces no results (or errors):
>
> strComputer = "."
>
> set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
> set colScheduledJobs = objWMI.ExecQuery("Select * from Win32_ScheduledJob")
> for each objJob in colScheduledJobs
> MsgBox objJob.Name
> next

 
Reply With Quote
 
Jason
Guest
Posts: n/a

 
      09-11-2008
Thank you.

And is there a WMI class (or other script-accessible class) with which I can
list the jobs created via the Scheduled Task interface?

"Masterplan" wrote:

> Hi Jason,
>
> The Win32_ScheduledJob WMI class represents a job created with the AT
> command. The Win32_ScheduledJob class does not represent a job created with
> the Scheduled Task Wizard from the Control Panel. That's why it produce no
> results.
>
> --
> Have a nice day!
>
> http://winmasterplan.blogspot.com
>
>
> "Jason" wrote:
>
> > I'm trying to list the scheduled tasks on a Win Server 2008 64-bit machine.
> > But running the following script produces no results (or errors):
> >
> > strComputer = "."
> >
> > set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
> > set colScheduledJobs = objWMI.ExecQuery("Select * from Win32_ScheduledJob")
> > for each objJob in colScheduledJobs
> > MsgBox objJob.Name
> > next

 
Reply With Quote
 
Masterplan
Guest
Posts: n/a

 
      09-11-2008
Hi again,

I didn't find such a specific class. I used a time ago schtasks /query to do
this.

--
Have a nice day!

http://winmasterplan.blogspot.com


"Jason" wrote:

> Thank you.
>
> And is there a WMI class (or other script-accessible class) with which I can
> list the jobs created via the Scheduled Task interface?
>
> "Masterplan" wrote:
>
> > Hi Jason,
> >
> > The Win32_ScheduledJob WMI class represents a job created with the AT
> > command. The Win32_ScheduledJob class does not represent a job created with
> > the Scheduled Task Wizard from the Control Panel. That's why it produce no
> > results.
> >
> > --
> > Have a nice day!
> >
> > http://winmasterplan.blogspot.com
> >
> >
> > "Jason" wrote:
> >
> > > I'm trying to list the scheduled tasks on a Win Server 2008 64-bit machine.
> > > But running the following script produces no results (or errors):
> > >
> > > strComputer = "."
> > >
> > > set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
> > > set colScheduledJobs = objWMI.ExecQuery("Select * from Win32_ScheduledJob")
> > > for each objJob in colScheduledJobs
> > > MsgBox objJob.Name
> > > next

 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Scheduled Tasks Meinolf Weber Windows Server 2 11-23-2007 03:55 AM
Scheduled tasks? Dan Active Directory 2 12-11-2006 01:23 AM
VBScript and Scheduled Tasks Steph Scripting 4 07-29-2005 09:28 AM
Scheduled Tasks BLOAKLEY Windows Server 3 04-22-2005 02:53 PM
scheduled tasks won't run Rolf Barbakken Windows Server 7 11-17-2004 11:43 AM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59