ajtsystems
IS-IT--Management
Hi,
I have written some code but need to get the output gnerated to the actual HTA window and then incriment it as the script loops.
I have done so far the ping routine but only echoing a text box to screen, here it is:
<HTML>
<HEAD>
<HTA:Application
Border = Thick
BorderStyle = Complex
ShowInTaskBar = YES
MaximizeButton = YES
MinimizeButton = YES
>
<SCRIPT LANGUAGE="VBScript">
Sub window_onLoad
Set objDocument = self.Document
objDocument.open
'Get name of target computer from user
strComputer = InputBox("Enter the name or IP of the computer you want information from. (Enter '.' for the local computer):")
'Verify information was entered by the user and close window if there was none.
If strcomputer = "" Then Window.Close()
'Ping computer specified by user input. If the computer doesn't respond to a ping, display a message box to the user
'letting them know. Then, close window.
Set objPing = GetObject("winmgmts:{impersonationLevel=impersonate}")._
ExecQuery("select * from Win32_PingStatus where address = '"_
& strcomputer & "'")
For Each objStatus in objPing
If IsNull(objStatus.StatusCode) or objStatus.StatusCode<>0 Then
MsgBoxValue = MsgBox ("Computer " & strComputer & " cannot be reached", 65, "Computer unavailable")
window.close()
Else MsgBoxValue = MsgBox ("Computer " & strComputer & " Is Reachable", 65, "Computer Available")
End If
Next
End Sub
</SCRIPT>
</HEAD>
<BODY>
</BODY>
</HTML>
Does anyone know how I can get my output to the screen within the HTA simply to make it slightly prettier?
Thanks
I have written some code but need to get the output gnerated to the actual HTA window and then incriment it as the script loops.
I have done so far the ping routine but only echoing a text box to screen, here it is:
<HTML>
<HEAD>
<HTA:Application
Border = Thick
BorderStyle = Complex
ShowInTaskBar = YES
MaximizeButton = YES
MinimizeButton = YES
>
<SCRIPT LANGUAGE="VBScript">
Sub window_onLoad
Set objDocument = self.Document
objDocument.open
'Get name of target computer from user
strComputer = InputBox("Enter the name or IP of the computer you want information from. (Enter '.' for the local computer):")
'Verify information was entered by the user and close window if there was none.
If strcomputer = "" Then Window.Close()
'Ping computer specified by user input. If the computer doesn't respond to a ping, display a message box to the user
'letting them know. Then, close window.
Set objPing = GetObject("winmgmts:{impersonationLevel=impersonate}")._
ExecQuery("select * from Win32_PingStatus where address = '"_
& strcomputer & "'")
For Each objStatus in objPing
If IsNull(objStatus.StatusCode) or objStatus.StatusCode<>0 Then
MsgBoxValue = MsgBox ("Computer " & strComputer & " cannot be reached", 65, "Computer unavailable")
window.close()
Else MsgBoxValue = MsgBox ("Computer " & strComputer & " Is Reachable", 65, "Computer Available")
End If
Next
End Sub
</SCRIPT>
</HEAD>
<BODY>
</BODY>
</HTML>
Does anyone know how I can get my output to the screen within the HTA simply to make it slightly prettier?
Thanks