iLogic Quick Tip: Get IP Address

I have a Vault server on my laptop, I connect to it via a second PC or via the Vault mobile App. I tend to use the IP address as the server name, because it works well with the mobile app. The problem is that my IP address changes each time I reboot the laptop. Firing up the command prompt and typing in “ipconfig” every time is tedious, so I wrote an iLogic utility to get the IP address and copy it to my clipboard

The code is well commented, so should be easy to follow.

Here’s the iLogic code:

'iLogic code by @ClintBrown3D, https://clintbrown.co.uk/ilogic-quick-tip-get-ip-address
'Get Computer Name
oPCName = System.Net.Dns.GetHostName()

'Get IP Adress
oIPAddress = System.Net.Dns.GetHostByName(oPCName).AddressList(0).ToString()

'Display Message box
MessageBox.Show("PC Name -> " & oPCName & vbNewLine & "IP Address -> " & oIPAddress, "@ClintBrown3D")

'Copy IP address to clipboard
Clipboard.SetText(oIPAddress)

Comments are closed.

Create a website or blog at WordPress.com

Up ↑

<span>%d</span> bloggers like this: