http://support.microsoft.com/kb/160215http://support.microsoft.com/kb/154512Tadaaaaa
Si lei bien con eso deberia ser suficiente.
Podia necesitarlo en un futuro, prefiero colgarlo aca para no perderlo.
' ////////////////////////////////////////////////////////////////
' // *GetIPfromHost //
' // *Autor: Elemental Code (Milton.Candelero@gmail.com) //
' // *Podeis agrandar o reducir el codigo, siempre y cuando se //
' // respete la autoria y se me comuniquen esos cambios. //
' ////////////////////////////////////////////////////////////////
Option Explicit
Public Function GetIPfromHost(ByRef sURL As String) As String
Dim WshShell, oExec, a$
Set WshShell = CreateObject("WScript.Shell")
Set oExec = WshShell.Exec("ping " & sURL)
a$ = ""
Do While oExec.Status = 0
If Not oExec.StdOut.AtEndOfStream Then
a$ = a$ & oExec.StdOut.Read(1)
End If
DoEvents
Loop
GetIPfromHost = Text_Between_Words(a$, "[", "]")
Set oExec = Nothing
Set WshShell = Nothing
End Function
' ////////////////////////////////////////////////////////////////
' // *Text_Between_Words //
' // *Autor: *PsYkE1* (miguelin.majo@gmail.com) //
' // *Podeis agrandar o reducir el codigo, siempre y cuando se //
' // respete la autoria y se me comuniquen esos cambios. //
' // *Agradecimientos a BlackZeroX. //
' // *Visita http://foro.rthacker.net //
' ////////////////////////////////////////////////////////////////
Public Function Text_Between_Words(Text As String, String1 As String, _
String2 As String) As String
Dim Pos1 As Integer
Dim Pos2 As Integer
Dim Start As Integer
Dim TotalLen As Integer
Pos1 = InStr(Text, String1)
Pos2 = InStr(Text, String2)
If Pos1 = 0 Or Pos2 = 0 Then Exit Function
Start = Pos1 + Len(String1)
TotalLen = Pos2 - Start
Text_Between_Words = Mid$(Text, Start, TotalLen)
End Function
Mete esto en un modulo y llamalo asi:
msgbox GetIPfromHost ("www.google.com")
Espero que sirva (Muestra una cmd en blanco :S, voy a ver si logro arreglarlo)