efiftythree
IS-IT--Management
I was looking through some archived threads and found this: thread329-905920
Im wondering how to add the machine hostname to the display functionality of the script. Here is the code mentioned in that thread
Any help would be great
Im wondering how to add the machine hostname to the display functionality of the script. Here is the code mentioned in that thread
Code:
<script language="VBScript">
Option Explicit
' On Error Resume Next
Dim colIPResults, objFile, objFSO, objNIC, objWMI, objWSHNetwork, strAddresses, strIPAddress, strWQL
Const FOR_APPENDING = 8
Sub DestroyObjects()
If IsObject(objFile) Then Set objFile = Nothing
If IsObject(objFSO) Then Set objFSO = Nothing
If IsObject(objWMI) Then Set objWMI = Nothing
If IsObject(objWSHNetwork) Then Set objWSHNetwork = Nothing
' If IsObject() Then Set = Nothing
End Sub
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objWSHNetwork = CreateObject("WScript.Network")
Set objWMI = GetObject("WinMGMTS:root\cimv2")
strWQL = "SELECT IPAddress FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = 'True'"
Set colIPResults = objWMI.ExecQuery(strWQL)
For Each objNIC In colIPResults
For Each strIPAddress in objNIC.IPAddress
If strAddresses = "" Then
strAddresses = strIPAddress
Else
strAddresses = strAddresses
End If
Next
Next
If strAddresses ="0.0.0.0" Or strAddresses ="" or strAddresses = "undefined" Then
Document.write("No Connection Detected")
Else
Document.write "Network Address - "+ strAddresses
End If
DestroyObjects()
</script>
Any help would be great