Find IP Address for Linux Host

NewOrderFac33

Well-known Member
Joined
Sep 26, 2011
Messages
1,275
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

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
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,213,550
Messages
6,114,265
Members
448,558
Latest member
aivin

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