QueryALL

Batch, ASP, JScript, Kixtart, etc.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Locked
1-jhernandez101

QueryALL

Post by 1-jhernandez101 »

when i click "queryall" nothing loads also if i move to another screen the load greys out and i can neber get back in . It just sits there. Here is some of my code....Am I missing something within this code...that may be casuing the problem


<div id="leftcolumn">
<HR><B><Font Color ="Grey">Computer/Server/IPAddress:</font></B>
<input type="text" name="Computer" size="30"><HR><center><select size="1" name="Choices" onChange="ChoiceScript" background-color : White><Option Value ="">Query Options:</Option><option value="System1">Operating System</option>
<option value="DiskSpace">Disk Space</option><option value="Motherboard">Motherboard Information</option><option value="Bios">BIOS Information</option><option value="VideoCard">Video Card</option><option value="SoundCard">SoundCard</option><option value="Memory">Physical RAM</option><option value="Processor">Processor(s)</option><option value="Network">Network Information</option><option value="Query420">Software Installed</option><option value="Services">Services</option><option value="Processes">Processes</option><option value="Query421">User Accounts</option><option value="Groups">User Groups</option>
</select>
<BR><BR><Font Color ="Grey"><input id=runbutton class="button" type="button" value="Query All" name="run_button" onClick="Query"><input id=runbutton class="button" type="button" value="Clear" name="run_button" onClick="Clear"><p></center>

1-jhernandez101

QueryALL

Post by 1-jhernandez101 »

Code: Select all

<html>
<head>
<title>Welcome to TESTXXX</title>
<HTA:APPLICATION
     APPLICATION="Yes"
     ID="HTA" 
     CONTEXTMENU="no"
     APPLICATIONNAME="TESTXXX"
     SCROLL="Yes"
     SINGLEINSTANCE="No"
     WINDOWSTATE="Maximize"
>
<</style>
</head>
 
<SCRIPT LANGUAGE="VBScript">
 

    Sub Motherboard
    On Error Resume Next
    strComputer = Computer.Value
    Set objWMIService = GetObject("winmgmts:" & strComputer & "rootcimv2")
 Set colItems = objWMIService.ExecQuery("Select * from Win32_BaseBoard",,48)
 
    strTEXT = "<table width='100%' id='Table1' >"
    strTEXT = strTEXT & "<tr>"
    strTEXT = strTEXT & "<td width='100%' bgcolor = 'black'><font color = 'white'><b>Motherboard Manufacture & ID<b></td>"
     strTEXT = strTEXT & "</tr>"
For Each objItem in colItems
   strTEXT = strTEXT & "<tr>"    
strTEXT = strTEXT & "<td width='100%'>" & objItem.Manufacturer & " " & objItem.Product &"</td>"
    strTEXT = strTEXT & "</tr>"
Next
        
         strTEXT = strTEXT & "</table>"
         DataMotherboard.InnerHTML = strTEXT
    End Sub
Sub Bios
On Error Resume Next
    strComputer = Computer.Value
Set objWMIService = GetObject("winmgmts:" & strComputer & "rootcimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_BIOS",,48)
strTEXT = "<table width='100%' id='Table1' >"
    strTEXT = strTEXT & "<tr>"
    strTEXT = strTEXT & "<td width='100%' bgcolor = 'black'><font color = 'white'><b>BIOS Manufacture & Version<b></td>"
     strTEXT = strTEXT & "</tr>"
For Each objItem in colItems
   strTEXT = strTEXT & "<tr>"    
strTEXT = strTEXT & "<td width='100%'>" & objItem.Manufacturer & " " & objItem.SMBIOSBIOSVersion &"</td>"
    strTEXT = strTEXT & "</tr>"
Next
        
         strTEXT = strTEXT & "</table>"
         DataBios.InnerHTML = strTEXT
 
End Sub

    Sub DiskSpace
  
 
        On Error Resume Next
        
       strComputer = Computer.value
       
        
        Set objWMIService = GetObject("winmgmts:" & strComputer & "rootcimv2")
        Set colDisks = objWMIService.ExecQuery("Select * From Win32_LogicalDisk")
       
     strTEXT = "<table width='100%' id='Table1' >"     
     
            strTEXT = strTEXT & "<tr>"
            strTEXT = strTEXT & "<td width='10%' bgcolor = 'black'><font color = 'white'><b>Drive/VolumeName </td>"
            strTEXT = strTEXT & "<td width='20%' bgcolor = 'black'><font color = 'white'><b>Total Space (GB) </td>"
     strTEXT = strTEXT & "<td width='20%' bgcolor = 'black'><font color = 'white'><b>Free Space (GB) </td>"
            strTEXT = strTEXT & "<td width='10%' bgcolor = 'black'><font color = 'white'><b>Used Space (GB) </td>"
            strTEXT = strTEXT & "<td width='20%' bgcolor = 'black'><font color = 'white'><b>File System (GB) </td>"
            strTEXT = strTEXT & "</tr>"
       
        For Each objDisk in colDisks 
            strTEXT = strTEXT & "<tr>"
           
            strTEXT = strTEXT & "<td width='10%'>" & objDisk.DeviceID & objDisk.VolumeName &"</td>"
            
            If objDisk.size > "" then
            strTEXT = strTEXT & "<td width='20%'>" & objDisk.Size / 1048576000 &"</td>" 
            End If
            If objDisk.FreeSpace > "" then
            strTEXT = strTEXT & "<td width='20%'>" & objDisk.FreeSpace / 1048576000 &"</td>"
            End If
            
            strTEXT = strTEXT & "<td width='10%'>" & objDisk.Size / 1048576000 - objDisk.FreeSpace / 1048576000 &"</td>"
            
            
            strTEXT = strTEXT & "<td width='20%'>" & objDisk.FileSystem &"</td>" 
            
            strTEXT = strTEXT & "</tr>"
            
        Next
        
         strTEXT = strTEXT & "</table>"
         DataArea.InnerHTML = strTEXT
    End Sub  
    
    'Physical Memory
       
    Sub Memory
        
        
        On Error Resume Next
        
        
        strComputer = Computer.value
        
            
        Set objWMIService = GetObject("winmgmts:" & strComputer & "rootcimv2")
        Set colSettings = objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystem")
            strTEXT = "<table width='100%' id='Table1' >"
            strTEXT = strTEXT & "<tr>"
            strTEXT = strTEXT & "<td width='100%' bgcolor = 'black'><font color = 'white'><b>Total Physical Memory (GB)</td>"
            strTEXT = strTEXT & "</tr>"
       
        For Each objComputer in colSettings
            strTEXT = strTEXT & "<tr>"
            If objComputer.TotalPysicalMemory > "" then
            strTEXT = strTEXT & "<td width='100%'>" & objComputer.TotalPhysicalMemory / 1024000000 &"</td>"
            End If
            strTEXT = strTEXT & "</tr>"
        Next
        strTEXT = strTEXT & "</table>"
        DataArea3.InnerHTML = strTEXT
    End Sub
    'Video Card
       
    Sub VideoCard
    
       On Error Resume Next
        strComputer = Computer.value
       
        Set objWMIService = GetObject("winmgmts:" & strComputer & "rootcimv2")
        Set colSettings = objWMIService.ExecQuery("SELECT * FROM Win32_VideoController")
            strTEXT = "<table width='100%' id='Table1' >"
            strTEXT = strTEXT & "<tr>"
            strTEXT = strTEXT & "<td width='100%' bgcolor = 'black'><font color = 'white'><b>Video Card</td>"
            strTEXT = strTEXT & "</tr>"
       
        For Each objCaption in colSettings
            strTEXT = strTEXT & "<tr>"
            If objCaption.Caption > "" then
            strTEXT = strTEXT & "<td width='100%'>" & objCaption.Caption & "</td>"
            End If
            strTEXT = strTEXT & "</tr>"
        Next
        strTEXT = strTEXT & "</table>"
        DataArea2.InnerHTML = strTEXT
    End Sub
 
 

   'Processor
    Sub Processor
    
    
        On Error Resume Next
        strComputer = Computer.value
       
        
        Set objWMIService = GetObject("winmgmts:" & strComputer & "rootcimv2")
        Set colSettings = objWMIService.ExecQuery("Select * from Win32_Processor")
            strTEXT = "<table width='100%' id='Table1' >"
            strTEXT = strTEXT & "<tr>"
            strTEXT = strTEXT & "<td width='33.3%' bgcolor = 'black'><font color = 'white'><b>Processor(s)</td>"
            strTEXT = strTEXT & "<td width='33.3%' bgcolor = 'black'><font color = 'white'><b>Manufacturer</td>"
            strTEXT = strTEXT & "<td width='33.3%' bgcolor = 'black'><font color = 'white'><b>Max Clock Speed Mhz</td>"
            strTEXT = strTEXT & "</tr>"
        
        For Each objProcessor in colSettings
            strTEXT = strTEXT & "<tr>"
            If objProcessor.Name > "" then
            strTEXT = strTEXT & "<td width='33.3%'>" & objProcessor.Name & "</td>"
            End If
            strTEXT = strTEXT & "<td width='33.3%'>" & objProcessor.Manufacturer & "</td>"
            strTEXT = strTEXT & "<td width='33.3%'>" & objProcessor.MaxClockSpeed & "</td>"
            strTEXT = strTEXT & "</tr>"
        Next
        strTEXT = strTEXT & "</table>"
        DataArea4.InnerHTML = strTEXT
    End Sub

    Sub System1
    
    
   
        On Error Resume Next
        strComputer = Computer.value
       
        
        Set objWMIService = GetObject("winmgmts:" & strComputer & "rootcimv2")
        Set colSettings = objWMIService.ExecQuery("SELECT * FROM Win32_OperatingSystem")
            strTEXT = "<table width='100%' id='Table1' >"
            strTEXT = strTEXT & "<tr>"
            strTEXT = strTEXT & "<td width='33.3%' bgcolor = 'black'><font color = 'white'><b>Computer Name</td>"
            strTEXT = strTEXT & "<td width='33.3%' bgcolor = 'black'><font color = 'white'><b>Operating System</td>"
            strTEXT = strTEXT & "<td width='33.3%' bgcolor = 'black'><font color = 'white'><b>Service Pack #</td>"
            strTEXT = strTEXT & "</tr>"
     
        For Each objOperatingSystem in colSettings
            strTEXT = strTEXT & "<tr>"
            If objOperatingSystem.Name > "" then
            strTEXT = strTEXT & "<td width='33.3%'>" & objOperatingSystem.CSName& "</td>"
            strTEXT = strTEXT & "<td width='33.3%'>" & objOperatingSystem.Caption & " " & objOperatingSystem.Version & "</td>"
                        strTEXT = strTEXT & "<td width='33.3%'>" & objOperatingSystem.CSDVersion & "</td>"
            End If
            strTEXT = strTEXT & "</tr>"
        Next
        strTEXT = strTEXT & "</table>"
        DataArea1.InnerHTML = strTEXT
    End Sub
    'Network Info ----------------------------------------------------------------------------------------------------------
    Sub Network
    
    
   
        On Error Resume Next
        
        strComputer = Computer.value
        
       
        Set objWMIService = GetObject("winmgmts:" & strComputer & "rootcimv2")
        Set colsettings = objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration")
       
     strTEXT = "<table width='100%' id='Table1' >"     
     
            strTEXT = strTEXT & "<tr>"
            strTEXT = strTEXT & "<td width='30%' bgcolor = 'black'><font color = 'white'><b>Network Discription</td>"
            strTEXT = strTEXT & "<td width='20%' bgcolor = 'black'><font color = 'white'><b>IP Address</td>"
            strTEXT = strTEXT & "<td width='30%' bgcolor = 'black'><font color = 'white'><b>DNS</td>"
            strTEXT = strTEXT & "<td width='20%' bgcolor = 'black'><font color = 'white'><b>Default Gateway</td>"
            strTEXT = strTEXT & "</tr>"
            
            
            For Each objNetwork in colsettings 
            strIPAddress = Join(objNetwork.IPAddress, ",")
            strDNSServerSearchOrder = Join(objNetwork.DNSServerSearchOrder, ",")
     strDefaultIPGateway = Join(objNetwork.DefaultIPGateway, ",")
            
            If strIPAddress = "" Then
            strIPAddress = ""
            End If 
            If strDNSServerSearchOrder = "" Then
            strDNSServerSearchOrder = ""
            End If 
            If strDefaultIPGateway = "" Then
     strDefaultIPGateway = ""
            End If            
            strTEXT = strTEXT & "<tr>"
            If stripaddress > "" then 
            strTEXT = strTEXT & "<td width='30%'>" & objNetwork.Description & "</td>"
            End If
            If stripaddress > "" then 
            strTEXT = strTEXT & "<td width='20%'>" & strIPAddress & "</td>"
            End if
            If strDNSServerSearchOrder > "" then
            strTEXT = strTEXT & "<td width='30%'>" & strDNSServerSearchOrder & "</td>"
            End If
            If strDefaultIPGateway > "" then
            strTEXT = strTEXT & "<td width='20%'>" & strDefaultIPGateway & "</td>" 
            End If
            strTEXT = strTEXT & "</tr>"
        
 Next
         strTEXT = strTEXT & "</table>"
         DataArea5.InnerHTML = strTEXT
     
 
     End Sub
    
    'Finds Local Computer and Subs it to Textbox ---------------------------------------------------------------------------------
    Sub Window_Onload
    
    StrComputer = "."
    Set objWMIService = GetObject("winmgmts:" & strComputer & "rootcimv2")
    Set colSettings = objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystem")
    For Each ObjComp in colsettings
    strTEXT = strTEXT & ObjComp.Name
    Next
    
    Computer.Value = strTEXT
   
       
    
    End Sub
    'Finds Processes on Machine -------------------------------------------------------------------------------------------------
    Sub Processes
    
   
    On Error Resume Next
        
        strComputer = Computer.value
      
    Set objWMIService = GetObject("winmgmts:" & strComputer & "rootcimv2")
        Set colProcesses = objWMIService.ExecQuery("Select * From Win32_Process")
        strTEXT = "<table width='100%' id='Table1' >"
        strTEXT = strTEXT & "<tr>"
        strTEXT = strTEXT & "<td width='40%' bgcolor = 'black'><font color = 'white'><b>Process</td>"
        
        strTEXT = strTEXT & "<td width='40%' bgcolor = 'black'><font color = 'white'><b>Process Path</td>"
        strTEXT = strTEXT & "<td width='20%' bgcolor = 'black'><font color = 'white'><b>Memory used by Process (KB)</td>"
        strTEXT = strTEXT & "</tr>"
        
        For Each objProcess in colProcesses
            strTEXT = strTEXT & "<tr>"
            If objProcess.name > "" then
            strTEXT = strTEXT & "<td width='33%'>" & objProcess.Name & "</td>"
            End If
            If objProcess.objProcess.ExecutablePath  > "" then
            strTEXT = strTEXT & "<td width='15%'>" & objProcess.ExecutablePath & "</td>"
            End If
            If objProcess.PageFileUsage > "" then 
            strTEXT = strTEXT & "<td width='15%'>" & objProcess.PageFileUsage / 1048 &"</td>"
            End If
            strTEXT = strTEXT & "</tr>"
        
        Next 
              
        strTEXT = strTEXT & "</table>"
        DataArea7.InnerHTML = strTEXT
    End Sub
    'Finds Services on Machine -------------------------------------------------------------------------------------------------
    Sub Services
    
    
    
    On Error Resume Next
        
        strComputer = Computer.value
        
    Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!" & strComputer & "rootcimv2")
    Set colServices = objWMIService.ExecQuery("SELECT * FROM Win32_Service")
        strTEXT = "<table width='100%' id='Table1' >"
        strTEXT = strTEXT & "<tr>"
        strTEXT = strTEXT & "<td width='33%' bgcolor = 'Black'><font color = 'White'><b>Service Name: </td>"
        strTEXT = strTEXT & "<td width='33%' bgcolor = 'black'><font color = 'white'><b>Status: </td>"
        strTEXT = strTEXT & "<td width='63%' bgcolor = 'black'><font color = 'white'><b>Service Path: </td>"
        
        strTEXT = strTEXT & "</tr>"
       
        For Each objService in colServices
            strTEXT = strTEXT & "<tr>"
            If objectServices.Display > "" then
            strTEXT = strTEXT & "<td width='33%'>" & objService.DisplayName  & "</td>"
            End If
            
            If objservice.state = "Running" Then
            strTEXT = strTEXT & "<td width='33%' bgcolor = 'Green'><font color = 'white'>" & objService.State & "</td>"
            End If
           
            If objService.state = "Stopped" Then
              strTEXT = strTEXT & "<td width='33%' bgcolor = 'Red'><font color = 'white'>" & objService.State & "</td>"
            End If
            strTEXT = strTEXT & "<td width='63%'>" & objService.pathname  & "</td>"
            
            strTEXT = strTEXT & "</tr>"
        Next
        strTEXT = strTEXT & "</table>"
        DataArea6.InnerHTML = strTEXT
    End Sub
Sub SoundCard
 
    On Error Resume Next
        
        strComputer = Computer.value
    
        
    Set objWMIService = GetObject("winmgmts:" & strComputer & "rootcimv2")
     Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_SoundDevice", "WQL", _
                                          wbemFlagReturnImmediately + wbemFlagForwardOnly)
        strTEXT = "<table width='100%' id='Table1' >"
        strTEXT = strTEXT & "<tr>"
        strTEXT = strTEXT & "<td bgcolor = 'black'><font color = 'white'><b>Sound Card </td>"
       
        strTEXT = strTEXT & "</tr>"
        For Each objItem in colItems
            
            
            
            strTEXT = strTEXT & "<tr>"
            If objitem.description > "" then
            strTEXT = strTEXT & "<td>" & objItem.Description  & "</td>"
            End If
            strTEXT = strTEXT & "</tr>"
            
            
           
        Next
        strTEXT = strTEXT & "</table>"
        DataArea8.InnerHTML = strTEXT
    End Sub

   

    'Clears Info  ----------------------------------------------------------------------------------------------------------------
    Sub Clear

    Location.Reload(True)       
    End Sub
    'Print
    Sub RunPrint
    Window.Print()
    End Sub
     

  Sub RunScript
    strAnswer = window.prompt("Please enter the Location to save.", "C:Invenory1.xls")
    If IsNull(strAnswer) Then
        Msgbox "You clicked the Cancel button"
    Else
    
    
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    objFSO.CreateTextFile(strAnswer)
    Set objFile = objFSO.OpenTextFile(strAnswer, 2)
    objFile.WriteLine Data.InnerHTML
    objFile.Close
  Msgbox "Saved."
  End If
  End Sub
 
Sub Query420
   
   
On Error Resume Next
strComputer = Computer.value
Set objWMIService = GetObject("winmgmts:" & strComputer & "rootCIMV2")
Set colItems = objWMIService.ExecQuery ("Select * from Win32_Product")

        strTEXT = "<table width='100%' id='Table1' >"
        strTEXT = strTEXT & "<tr>"
        strTEXT = strTEXT & "<td width='40%' bgcolor = 'black'><font color = 'white'><b>Software</td>"
        strTEXT = strTEXT & "<td width='10%' bgcolor = 'black'><font color = 'white'><b>Software Version</td>"
        strTEXT = strTEXT & "<td width='20%' bgcolor = 'black'><font color = 'white'><b>Software Publisher</td>"
        strTEXT = strTEXT & "<td width='10%' bgcolor = 'black'><font color = 'white'><b>Software Install Date YYYYMMDD</td>"
       
        strTEXT = strTEXT & "</tr>"
 

For Each objItem In colItems
        strTEXT = strTEXT & "<tr>"
        strTEXT = strTEXT & "<td width='40%'>" & objItem.Description & " " & objItem.InstallLocation & "</td>"
        
        strTEXT = strTEXT & "<td width='10%'>" & objItem.Version & "</td>"
        strTEXT = strTEXT & "<td width='10%'>" & objItem.Vendor & "</td>"
        strTEXT = strTEXT & "<td width='10%'>" & objItem.InstallDate & "</td>"
            
        strTEXT = strTEXT & "</tr>"
   Next
        strTEXT = strTEXT & "</table>"
        DataArea420.InnerHTML = strTEXT
End Sub

Sub Query421
   
On Error Resume Next
strComputer = Computer.value

 Set objWMIService = GetObject("winmgmts:" & strComputer & "rootCIMV2")
   Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_UserAccount", "WQL", _
                                          wbemFlagReturnImmediately + wbemFlagForwardOnly)
        strTEXT = "<table width='100%' id='Table1' >"
        strTEXT = strTEXT & "<tr>"
        strTEXT = strTEXT & "<td width='20%' bgcolor = 'black'><font color = 'white'><b>User Accounts</td>"
        strTEXT = strTEXT & "<td width='20%' bgcolor = 'black'><font color = 'white'><b>User Name</td>"
        strTEXT = strTEXT & "<td width='5%' bgcolor = 'black'><font color = 'white'><b>Domain</td>"
        strTEXT = strTEXT & "<td width='30%' bgcolor = 'black'><font color = 'white'><b>Description</td>"
        strTEXT = strTEXT & "<td width='5%' bgcolor = 'black'><font color = 'white'><b>Status</td>"
        strTEXT = strTEXT & "<td width='5%' bgcolor = 'black'><font color = 'white'><b>Disabled</td>"
        
         strTEXT = strTEXT & "<td width='5%' bgcolor = 'black'><font color = 'white'><b>Password Expires</td>"
         
       
        strTEXT = strTEXT & "</tr>"
 

For Each objItem In colItems
        strTEXT = strTEXT & "<tr>"
        strTEXT = strTEXT & "<td width='20%'><B>" & objItem.Caption & "<b></td>"
        strTEXT = strTEXT & "<td width='20%'>" & objItem.Fullname & "</td>"
        strTEXT = strTEXT & "<td width='5%'>" & objItem.domain & "</td>"
        strTEXT = strTEXT & "<td width='30%'><i><Center>" & objItem.Description  & "</Center></i></td>" 
        If objItem.Status = "Degraded" then
        strTEXT = strTEXT & "<td width='5%'bgcolor = 'Red'>" & objItem.Status  & "</td>"
        End If
        If objItem.Status = "OK" then
        strTEXT = strTEXT & "<td width='5%'bgcolor = 'Green'>" & objItem.Status  & "</td>"
        End If
        If objItem.Disabled = "True" then
        strTEXT = strTEXT & "<td width='5%'bgcolor = 'Red'>" & objItem.Disabled  & "</td>"
        End If
        If ObjItem.Disabled = "False" then 
        strTEXT = strTEXT & "<td width='5%'bgcolor = 'Green'>" & objItem.Disabled  & "</td>"
        End If
         
        strTEXT = strTEXT & "<td width='5%'>" & objItem.PasswordExpires & "</td>"   
        strTEXT = strTEXT & "</tr>"
   Next
        strTEXT = strTEXT & "</table>"
        DataArea421.InnerHTML = strTEXT
End Sub
Sub Drivers
 

On Error Resume Next
strComputer = Computer.value

 Set objWMIService = GetObject("winmgmts:" & strComputer & "rootCIMV2")
 Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_SystemDriver", "WQL", _
                                          wbemFlagReturnImmediately + wbemFlagForwardOnly)
        strTEXT = "<table width='100%' id='Table1' >"
        strTEXT = strTEXT & "<tr>"
        strTEXT = strTEXT & "<td width='20%' bgcolor = 'black'><font color = 'white'><b>Driver</td>"
        strTEXT = strTEXT & "<td width='30%' bgcolor = 'black'><font color = 'white'><b>Path</td>"
        
        strTEXT = strTEXT & "<td width='20%' bgcolor = 'black'><font color = 'white'><b>Description</td>"
        strTEXT = strTEXT & "<td width='5%' bgcolor = 'black'><font color = 'white'><b>Status</td>"
              
         strTEXT = strTEXT & "<td width='5%' bgcolor = 'black'><font color = 'white'><b>Driver State</td>"
         
       
        strTEXT = strTEXT & "</tr>"
 

For Each objItem In colItems
        strTEXT = strTEXT & "<tr>"
        strTEXT = strTEXT & "<td width='20%'><B>" & objItem.Caption & "</B></td>"
        strTEXT = strTEXT & "<td width='30%'>" & objItem.PathName & "</td>"
        
        strTEXT = strTEXT & "<td width='20%'><i><center>" & objItem.Description  & "</center></i></td>" 
        If objItem.Status = "Degraded" then
                strTEXT = strTEXT & "<td width='5%'bgcolor = 'Red'>" & objItem.Status  & "</td>"
        End If
        If objItem.Status = "OK" then
        strTEXT = strTEXT & "<td width='5%'bgcolor = 'Green'>" & objItem.Status  & "</td>"
   
        End If
        If objItem.State = "Stopped" then       
        strTEXT = strTEXT & "<td width='5%'bgcolor = 'Red'>" & objItem.state & "</td>"
        End If
        If objItem.State = "Running" then
        strTEXT = strTEXT & "<td width='5%'bgcolor = 'Green'>" & objItem.state & "</td>"  
        End If
        strTEXT = strTEXT & "</tr>"
   Next
        strTEXT = strTEXT & "</table>"
        DataAreaDrivers.InnerHTML = strTEXT
End Sub
Sub Groups
 

On Error Resume Next
strComputer = Computer.value

 Set objWMIService = GetObject("winmgmts:" & strComputer & "rootCIMV2")
 Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_Group", "WQL", _
                                          wbemFlagReturnImmediately + wbemFlagForwardOnly)
        strHTML = "<table BORDER='5' width='50%' id='Table1' >"
        strTEXT = strTEXT & "<tr>"
        strTEXT = strTEXT & "<td width='20%' bgcolor = 'black'><font color = 'white'><b>Group</td>"
        strTEXT = strTEXT & "<td width='30%' bgcolor = 'black'><font color = 'white'><b>Group Name</td>"
        strTEXT = strTEXT & "<td width='30%' bgcolor = 'black'><font color = 'white'><b>Domain</td>"
        strTEXT = strTEXT & "<td width='20%' bgcolor = 'black'><font color = 'white'><b>Description</td>"
        strTEXT = strTEXT & "<td width='5%' bgcolor = 'black'><font color = 'white'><b>Status</td>"
        strTEXT = strTEXT & "<td width='5%' bgcolor = 'black'><font color = 'white'><b>Install Date</td>"
                      
       
        strTEXT = strTEXT & "</tr>"
 

For Each objItem In colItems
        strTEXT = strTEXT & "<tr>"
        strTEXT = strTEXT & "<td width='20%'><B>" & objItem.Caption & "</B></td>"
       
        strTEXT = strTEXT & "<td width='30%'><B>" & objItem.Name & "</B></td>"
        strTEXT = strTEXT & "<td width='30%'><B>" & objItem.Domain & "</B></td>"
        strTEXT = strTEXT & "<td width='20%'><i><center>" & objItem.Description  & "</center></i></td>" 
        If objItem.Status = "Degraded" then
        strTEXT = strTEXT & "<td width='5%'bgcolor = 'Red'>" & objItem.Status  & "</td>"
        End If
        If objItem.Status = "OK" then
        strTEXT = strTEXT & "<td width='5%'bgcolor = 'Green'>" & objItem.Status  & "</td>"
        End If
        strTEXT = strTEXT & "<td width='5%'>" & objItem.InstallDate & "</td>"
        strTEXT = strTEXT & "</tr>"
Next
        strTEXT = strTEXT & "</table>"
        DataGroups.InnerHTML = strTEXT
End Sub
 
Sub Query422
 

On Error Resume Next
strComputer = Computer.value

Set objWMIService = GetObject("winmgmts:" & strComputer & "rootCIMV2")
Set colItems = objWMIService.ExecQuery _
    ("Select * from Win32_NTLogEvent Where Logfile = 'Application'")
strHTML = "<table BORDER='5' WIDTH='50%'>"
        
        
 strHTML = strHTML & "<tr>"
        strHTML = strHTML & "EVENT LOGS FOR APPLICATIONS" 
        strHTML = strHTML & "<td width='5%' bgcolor = 'black'><font color = 'white'>Event Code</td>"
        strHTML = strHTML & "<td width='25%' bgcolor = 'black'><font color = 'white'>Message</td>"
        strHTML = strHTML & "<td width='10%' bgcolor = 'black'><font color = 'white'>Source Name</td>"
        strHTML = strHTML & "<td width='10%' bgcolor = 'black'><font color = 'white'>User</td>"
        strHTML = strHTML & "</tr>"                    
For Each objItem In colItems
        strHTML = strHTML & "<tr>"
        strHTML = strHTML & "<td width='5%'>" & objItem.EventCode & "</td>"
        strHTML = strHTML & "<td width='25%'>" & objItem.Message & "</td>"
        strHTML = strHTML & "<td width='10%'>" & objItem.SourceName & "</td>"
        strHTML = strHTML & "<td width='10%'>" & objItem.User & "</td>"
        strHTML = strHTML & "</tr>"

Next
        
        strHTML = strHTML & "</table>"
        DataArea422.InnerHTML = strHTML

End Sub
Sub Query424
On Error Resume Next
strComputer = Computer.value

Set objWMIService = GetObject("winmgmts:" & strComputer & "rootCIMV2")
Set colItems = objWMIService.ExecQuery _
    ("Select * from Win32_NTLogEvent Where Logfile = 'System'")
strHTML = "<table BORDER='5' WIDTH='50%'>"
        
        
 strHTML = strHTML & "<tr>"
        strHTML = strHTML & "EVENT LOGS FOR SYSTEM" 
        strHTML = strHTML & "<td width='5%' bgcolor = 'black'><font color = 'white'>Event Code</td>"
        strHTML = strHTML & "<td width='10%' bgcolor = 'black'><font color = 'white'>Message</td>"
        strHTML = strHTML & "<td width='10%' bgcolor = 'black'><font color = 'white'>Source Name</td>"
        strHTML = strHTML & "<td width='10%' bgcolor = 'black'><font color = 'white'>User</td>"
        strHTML = strHTML & "</tr>"                    
For Each objItem In colItems
        strHTML = strHTML & "<tr>"
        strHTML = strHTML & "<td width='5%'>" & objItem.EventCode & "</td>"
        strHTML = strHTML & "<td width='10%'>" & objItem.Message & "</td>"
        strHTML = strHTML & "<td width='10%'>" & objItem.SourceName & "</td>"
        strHTML = strHTML & "<td width='10%'>" & objItem.User & "</td>"
        strHTML = strHTML & "</tr>"

Next
        
        strHTML = strHTML & "</table>"
        DataArea424.InnerHTML = strHTML

End Sub

Sub EventSys

call Query424
 
End Sub
Sub EventApp
Call Query422
End Sub

Sub Query

Call System1
Call Query420
Call DiskSpace
Call Motherboard
Call Bios
Call VideoCard

Call SoundCard
Call Processor
Call Memory
Call Network
Call Drivers
Call Services
Call Processes
Call Query421
Call Groups
 
 
End Sub
Sub ChoiceScript
If Choices.Value = "" Then
           Call Clear
        End If
If Choices.Value = "System1" Then
           Call System1
        End If
If Choices.Value = "Query420" Then
           Call Query420
        End If
If Choices.Value = "DiskSpace" Then
           Call DiskSpace
        End If
If Choices.Value = "Motherboard" Then
           Call Motherboard
        End If
If Choices.Value = "Bios" Then
           Call Bios
        End If
If Choices.Value = "VideoCard" Then
           Call VideoCard
        End If
If Choices.Value = "SoundCard" Then
           Call SoundCard
        End If
If Choices.Value = "Processor" Then
           Call Processor
        End If
If Choices.Value = "Memory" Then
           Call Memory
        End If
If Choices.Value = "Network" Then
           Call Network
        End If
If Choices.Value = "Drivers" Then
           Call Drivers
        End If
If Choices.Value = "Services" Then
           Call Services
        End If
If Choices.Value = "Processes" Then
           Call Processes
        End If
If Choices.Value = "Query421" Then
           Call Query421
        End If
If Choices.Value = "Groups" Then
           Call Groups
        End If
 
End Sub
 
 

     
</SCRIPT>
 
<body STYLE="font:12 pt arial; color:white;
 filter:progid:DXImageTransform.Microsoft.Gradient
(GradientType=1, StartColorStr='#000000', EndColorStr='#0000FF')">

<div id="leftcolumn">
<HR>
<B><Font Color ="Grey">Computer/Server/IPAddress:</font></B>
<input type="text" name="Computer" size="30">
<HR>
<center>
<select size="1" name="Choices" onChange="ChoiceScript" background-color : White>
<Option Value ="">Query Options:</Option>
<option value="System1">Operating System</option>
<option value="DiskSpace">Disk Space</option>
<option value="Motherboard">Motherboard Information</option>
<option value="Bios">BIOS Information</option>
<option value="VideoCard">Video Card</option>
<option value="SoundCard">SoundCard</option>
<option value="Memory">Physical RAM</option>
<option value="Processor">Processor(s)</option>
<option value="Network">Network Information</option>
<option value="Query420">Software Installed</option>
<option value="Services">Services</option>
<option value="Processes">Processes</option>
<option value="Query421">User Accounts</option>
<option value="Groups">User Groups</option>

</select>



<Font Color ="Grey">
<input id=runbutton  class="button" type="button" value="Query All" name="run_button"  onClick="Query">
<input id=runbutton  class="button" type="button" value="Clear" name="run_button"  onClick="Clear"><p>
</center>
<HR>
Bonus:


<input id=runCheckbox  class="Checkbox" type="Checkbox" value="System Events" name="run_Checkbox"  onClick="EventSys">System Events

<input id=runCheckbox  class="Checkbox" type="Checkbox" value="Application Events" name="run_Checkbox"  onClick="EventApp">Application Events

<input id=runCheckbox  class="Checkbox" type="Checkbox" value="Network Protocols" name="run_Checkbox"  onClick="NetworkPro">Network Protocols

<input id=runCheckbox  class="Checkbox" type="Checkbox" value="Increase Startup Delay" name="run_Checkbox"  onClick="Startup">Decrease Startup Delay


<input id=runCheckbox  class="Checkbox" type="Checkbox" value="Reboot Machine" name="run_Checkbox"  onClick="Reboot">Reboot Machine

<input id=runCheckbox  class="checkbox" type="Checkbox" value="Shutdown Machine" name="run_checkbox"  onClick="Shutit">Shutdown Machine<p>
<input id=runbutton  class="button" type="button" value="Print" name="run_button"  onClick="RunPrint">
<input id=runbutton  class="button" type="button" value="Clear" name="run_button"  onClick="Clear">
<input id=runbutton  class="button" type="button" value="Save to" name="run_button"  onClick="Runscript"><P></Center>


</Font>
</center>

</div>
 

<div id="maincontent">
 

 <U>DATA RETURNED BY QUERY</U>



<span id = "Data">
<tr>
<td><span id = "DataArea1"></span></td>
</tr>
<tr>
<td><span id = "DataArea"></span></td>
</tr>
<tr>
<td><span id = "DataArea3"></span></td>
</tr>
<tr>
<td><span id = "DataArea4"></span></td>
</tr>
<tr>
<td><span id = "DataArea2"></span></td>
</tr>
<tr>
<td><span id = "DataArea8"></span></td>
</tr>
<tr>
<td><span id = "DataMotherboard"></span></td>
</tr>
<tr>
<td><span id = "DataBios"></span></td>
</tr>
<tr>
<td><span id = "DataNetworkPro"></span></td>
</tr>
<tr>
<td><span id = "DataArea5"></span></td>
</tr> 
<tr>
<td><span id = "DataAreaDrivers"></span></td>
</tr>
<tr>
<td><span id = "DataArea420"></span></td>
</tr>
<tr>
<td><span id = "DataArea7"></span></td>
</tr>
<tr>
<td><span id = "DataArea6"></span></td>
</tr>
<tr>
<td><span id = "DataArea424"></span></td>
</tr>
<tr>
<td><span id = "DataArea422"></span></td>
</tr>
<tr>
<td><span id = "DataArea421"></span></td> 
</tr> 
<tr>
<td><span id = "DataGroups"></span></td>
</tr>
</span>
</div>
 
<div id="rightcolumn">
 
</div>
<div id="footer"><Center>
</div>

</center>
</Body>

User avatar
jhicks
Posts: 1789
Joined: Sun Jan 21, 2007 11:31 pm

QueryALL

Post by jhicks »

I had the HTA skip the installed software routine when using Query all and it was much faster.

jvierra
Posts: 14546
Joined: Tue May 22, 2007 9:57 am
Contact:

QueryALL

Post by jvierra »

Use the time to schedulte each test. The timer will create events that will let the browser refresh and sho each steps result as soon as it finishes. This will give the user positive feedback.

Set teh tier for 100 ms and give it the sub to run on completion. Have each timer schedule the next test in the sequence.

You can also keep the GUI alive by posting status messages to a text box using an event or just by writing to the box and refreshing it.
When a script is running all events are blocked until the script exits unless you send a message from teh script to the form. Assingning "innerHTML" does not create an event. Assign teh "innerHTML" and then "refresh" the object just assigned.

I believe this will give you what you are looking for.

Antoher method frequently used is to open a second browser and updating it from teh first. This will act like a report being generated and should keep something onscreen active.

jvierra
Posts: 14546
Joined: Tue May 22, 2007 9:57 am
Contact:

QueryALL

Post by jvierra »

Jef is saying that the UI - the IE HTML form - is being blocked from updates until all of teh scripts have finished running. This makes it appear like the interface is dead whil teh scripts execute.

My suggestion was to use teh "window'timer" metod to create a timer that call a sub.

I will look around for an example in my junk box.

The HTA worksbut it's just slow. Not much you can do about this. i looked at your code and it is doing what it needs to do. The routines (WMI) are just slow when running remotely.

Try running the script from a command line and outputting the strings with WScript.ECHO instead of assigning them to an HTML object. You will see how slow it is in your network.

THe string concatenation method is alright for small amounts of HTML but gets quite slow when cat'ing big strings. This also slow things down. A faster way would be t dump to an XML file and use XSLT to render the report. This is an advanced technique but is the way it is usually done for large complex reports. Writing pieces to a file is faster. ten adding strings.

YOu could also just output all of your HTML to a file and then run teh HTML file to pop up the report.

There is also an HTML sampler I placed in teh ScriptVault that demonstrates various methods of updating a form and having the updates appear immediately. It contains a form with numerous controls and pieces of code that demo the update methods.

http://www.scriptinganswers.com/vault/W ... ampler.zip

By the way - your HTA looks like a fair amount of effort on your part. It has a pretty nice display format too. A little optimization and it would fly.
jvierra2007-06-06 13:25:41

Locked