Skip to content

Instantly share code, notes, and snippets.

@andreipak
Last active October 15, 2015 16:39

Revisions

  1. andreipak revised this gist Oct 15, 2015. 1 changed file with 7 additions and 2 deletions.
    9 changes: 7 additions & 2 deletions iewmi.vbs
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,13 @@
    ' https://msdn.microsoft.com/en-us/library/aa394599(v=vs.85).aspx [WMI Tasks: Processes]
    On Error Resume Next
    Set FSO = CreateObject("Scripting.FileSystemObject")
    Set MSIE = CreateObject("InternetExplorer.Application")
    Set ScheduledJob = GetObject("winmgmts:{impersonationLevel=impersonate}!\\computer\root\cimv2").ExecQuery("select * from Win32_ScheduledJob")
    computer = "."
    Set ScheduledJob = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & computer & "\root\cimv2").ExecQuery("select * from Win32_ScheduledJob")

    'SetupMSIE
    MSIE.Visible = True

    SetupMSIE
    MSIE.Document.Write "<HTML><TITLE>Scheduled Jobs" & _
    "</TITLE><BODY bgcolor=#ffffff><FONT FACE=ARIAL>"
    MSIE.Document.Write "<B>Displaying tasks created " & _
    @@ -58,3 +62,4 @@ MSIE.Document.Write "<B>Displaying tasks created " & _
    "<td>&nbsp;</td><td align=right>" & Prop & _
    "</td></tr>"
    End Sub

  2. andreipak revised this gist Oct 15, 2015. No changes.
  3. andreipak created this gist Oct 15, 2015.
    60 changes: 60 additions & 0 deletions iewmi.vbs
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,60 @@
    On Error Resume Next
    Set FSO = CreateObject("Scripting.FileSystemObject")
    Set MSIE = CreateObject("InternetExplorer.Application")
    Set ScheduledJob = GetObject("winmgmts:{impersonationLevel=impersonate}!\\computer\root\cimv2").ExecQuery("select * from Win32_ScheduledJob")

    'SetupMSIE
    MSIE.Document.Write "<HTML><TITLE>Scheduled Jobs" & _
    "</TITLE><BODY bgcolor=#ffffff><FONT FACE=ARIAL>"
    MSIE.Document.Write "<B>Displaying tasks created " & _
    "with WMI or the AT command:</B><BR><BR>" & _
    "<table border=0 width=100% cellspacing=0 " & _
    "cellpadding=0>"
    For each ejob in ScheduledJob
    IEWrite "Caption", EJob.Caption
    IEWrite "Command", EJob.Command
    IEWrite "Days Of Month", EJob.DaysOfMonth
    IEWrite "Days Of Week", EJob.DaysOfWeek
    IEWrite "Description", EJob.Description
    IEWrite "Install Date" ,EJob.InstallDate
    IEWrite "Interact With Desktop", EJob.InteractWithDesktop
    IEWrite "Job ID", EJob.JobID
    IEWrite "Job Status", EJob.JobStatus
    IEWrite "Name", EJob.Name
    IEWrite "Notify", EJob.Notify
    IEWrite "Owner", EJob.Owner
    IEWrite "Priority", EJob.Priority
    IEWrite "Run Repeatedly", EJob.RunRepeatedly
    IEWrite "Start Time", EJob.StartTime
    IEWrite "Status", EJob.Status
    IEWrite "Time Submitted", EJob.TimeSubmitted
    IEWrite "Until Time", EJob.UntilTime
    IEWrite " ", " "
    Next

    MSIE.Document.Write "</table><BR><B>End of List</B>" & _
    "</FONT></BODY>"

    Sub SetupMSIE
    MSIE.Navigate "About:Blank"
    MSIE.ToolBar = False
    MSIE.StatusBar = False
    MSIE.Resizable = False

    Do
    Loop While MSIE.Busy

    SWidth = MSIE.Document.ParentWindow.Screen.AvailWidth
    SHeight = MSIE.Document.ParentWindow.Screen.AvailHeight
    MSIE.Width = SWidth/2
    MSIE.Height = SHeight/2
    MSIE.Left = (SWidth - MSIE.Width)/2
    MSIE.Top = (SHeight - MSIE.Height)/2

    MSIE.Visible = True
    End Sub
    Sub IEWrite(Caption,Prop)
    MSIE.Document.Write "<tr><td>" & Caption & "</td>" & _
    "<td>&nbsp;</td><td align=right>" & Prop & _
    "</td></tr>"
    End Sub