cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
drobertson
Engaged Sweeper III

Run this asset action:


{actionpath}list_ip_config.vbs {computer}



Here is the content of "list_ip_config.vbs"


' List IP Configuration Data

strComputer = WScript.Arguments(0)

Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colAdapters = objWMIService.ExecQuery _
("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")

n = 1
strMsg = ""

For Each objAdapter in colAdapters
strMsg = strMsg & "Network Adapter " & VbCrLf
strMsg = strMsg & "=================" & VbCrLf
strMsg = strMsg & " Description: " & objAdapter.Description & VbCrLf

strMsg = strMsg & " Physical (MAC) address: " & objAdapter.MACAddress & VbCrLf
strMsg = strMsg & " Host name: " & objAdapter.DNSHostName & VbCrLf

If Not IsNull(objAdapter.IPAddress) Then
For i = 0 To UBound(objAdapter.IPAddress)
strMsg = strMsg & " IP address: " & objAdapter.IPAddress(i) & VbCrLf
Next
End If

If Not IsNull(objAdapter.IPSubnet) Then
For i = 0 To UBound(objAdapter.IPSubnet)
strMsg = strMsg & " Subnet: " & objAdapter.IPSubnet(i) & VbCrLf
Next
End If

If Not IsNull(objAdapter.DefaultIPGateway) Then
For i = 0 To UBound(objAdapter.DefaultIPGateway)
strMsg = strMsg & " Default gateway: " & _
objAdapter.DefaultIPGateway(i) & VbCrLf
Next
End If

strMsg = strMsg & "" & VbCrLf
strMsg = strMsg & " DNS" & VbCrLf
strMsg = strMsg & "=================" & VbCrLf
strMsg = strMsg & " DNS servers in search order:" & VbCrLf

If Not IsNull(objAdapter.DNSServerSearchOrder) Then
For i = 0 To UBound(objAdapter.DNSServerSearchOrder)
strMsg = strMsg & " " & objAdapter.DNSServerSearchOrder(i) & VbCrLf
Next
End If

strMsg = strMsg & " DNS domain: " & objAdapter.DNSDomain & VbCrLf

If Not IsNull(objAdapter.DNSDomainSuffixSearchOrder) Then
For i = 0 To UBound(objAdapter.DNSDomainSuffixSearchOrder)
strMsg = strMsg & " DNS suffix search list: " & _
objAdapter.DNSDomainSuffixSearchOrder(i) & VbCrLf
Next
End If

strMsg = strMsg & "" & VbCrLf
strMsg = strMsg & " DHCP" & VbCrLf
strMsg = strMsg & "=================" & VbCrLf
strMsg = strMsg & " DHCP enabled: " & objAdapter.DHCPEnabled & VbCrLf
strMsg = strMsg & " DHCP server: " & objAdapter.DHCPServer & VbCrLf

If Not IsNull(objAdapter.DHCPLeaseObtained) Then
utcLeaseObtained = objAdapter.DHCPLeaseObtained
strLeaseObtained = WMIDateStringToDate(utcLeaseObtained)
Else
strLeaseObtained = ""
End If
strMsg = strMsg & " DHCP lease obtained: " & strLeaseObtained & VbCrLf

If Not IsNull(objAdapter.DHCPLeaseExpires) Then
utcLeaseExpires = objAdapter.DHCPLeaseExpires
strLeaseExpires = WMIDateStringToDate(utcLeaseExpires)
Else
strLeaseExpires = ""
End If
strMsg = strMsg & " DHCP lease expires: " & strLeaseExpires & VbCrLf

strMsg = strMsg & "" & VbCrLf
strMsg = strMsg & " WINS" & VbCrLf
strMsg = strMsg & "=================" & VbCrLf
strMsg = strMsg & " Primary WINS server: " & objAdapter.WINSPrimaryServer & VbCrLf
strMsg = strMsg & " Secondary WINS server: " & objAdapter.WINSSecondaryServer & VbCrLf
strMsg = strMsg & ""

n = n + 1

Next

Function WMIDateStringToDate(utcDate)
WMIDateStringToDate = CDate(Mid(utcDate, 5, 2) & "/" & _
Mid(utcDate, 7, 2) & "/" & _
Left(utcDate, 4) & " " & _
Mid (utcDate, 9, 2) & ":" & _
Mid(utcDate, 11, 2) & ":" & _
Mid(utcDate, 13, 2))
End Function


msgbox strMsg,0,"IP Configuration Data"
0 REPLIES 0