Find IP Address for Linux Host

NewOrderFac33

Well-known Member
Joined
Sep 26, 2011
Messages
1,255
Good afternoon, RoryA kindly provided me with the following function to determine the IP address of a remote host, but whilst it works happily for Windows hosts, it doesn't work for Linux ones.
Code:
Function fWMIGetIPAddress(strComputer As String) As String
   Dim objWMIService, colItems, objItem
   Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
   Set colItems = objWMIService.ExecQuery _
                  ("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True")

   For Each objItem In colItems
      fWMIGetIPAddress = objItem.IPAddress(0)
      Exit For
   Next objItem
End Function
Does anyone have an equivalent for Linux hosts, please - please note, it needs to work in Win10/Office 2016 64 bit, please.
Thanks in advance and have a nice weekend, all!
Pete
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!

NewOrderFac33

Well-known Member
Joined
Sep 26, 2011
Messages
1,255
Really embarrasing to admit (especially to Rory!), but it DOES work on Linux - it would have been useful if I'd checked that the server i was pinging was actually up that day... my MAJOR bad.
 
Last edited:

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
36,696
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2010
Platform
  1. Windows
  2. MacOS
:0) Made me chuckle though.
 

Watch MrExcel Video

Forum statistics

Threads
1,129,579
Messages
5,637,209
Members
416,961
Latest member
sigrid6940

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top