Pc ip alma Modülü

Function GetirIP()
Const strComputer As String = “.” ‘ Computer name. Dot means local computer
Dim objWMIService, IPConfigSet, IPConfig, IPAddress, I
Dim strIPAddress As String

‘ Connect to the WMI service
Set objWMIService = GetObject(“winmgmts:” _
& “{impersonationLevel=impersonate}!\\” & strComputer & “\root\cimv2”)

‘ Get all TCP/IP-enabled network adapters
Set IPConfigSet = objWMIService.ExecQuery _
(“Select * from Win32_NetworkAdapterConfiguration Where IPEnabled=TRUE”)

‘ Get all IP addresses associated with these adapters
For Each IPConfig In IPConfigSet
IPAddress = IPConfig.IPAddress
If Not IsNull(IPAddress) Then
strIPAddress = strIPAddress & Join(IPAddress, “, “)
End If
Next

GetirIP = strIPAddress
End Function

4 Görüntülendi.

Bunları da sevebilirsiniz