Last active
October 15, 2015 16:39
-
-
Save andreipak/21edb346fef5ebbb99be to your computer and use it in GitHub Desktop.
WSH: WMI within MSIE Sample code. [InternetExplorer.Application + Win32_ScheduledJob]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' 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") | |
computer = "." | |
Set ScheduledJob = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & computer & "\root\cimv2").ExecQuery("select * from Win32_ScheduledJob") | |
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 " & _ | |
"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> </td><td align=right>" & Prop & _ | |
"</td></tr>" | |
End Sub | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment