Find IP Address for Linux Host

NewOrderFac33

Well-known Member
Joined
Sep 26, 2011
Messages
1,283
Office Version
  1. 2016
  2. 2010
Platform
  1. Windows
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

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
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:
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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
Back
Top