Tuesday, February 1, 2011

Get the local IP using VBS

This is a handy function that returns the local IP settings.
I run it (like many people) at boot on servers to have the IP address
sent to me every time the server starts up, in case the IP have changed.

Function GetLocalIPConfig
  strResult = ""
  With CreateObject("Wscript.Shell").Exec("ipconfig").StdOut
    Do Until .AtEndOfStream
      strResult = strResult & .ReadLine
  End With
  GetLocalIPConfig = strResult
End Function

No comments: