Danke für die Links, Eknori.
Ich hab irgendwie das Gefühl, dass ich zu dumm für APIs bin. Hab das Werkl nicht zum laufen gebracht.
Nachdem die Tränen wegen meiner Unfähigkeit getrocknet sind, hab ich etwas gesucht und bin dann über diesen Fred (http://atnotes.de/index.php/topic,4107.msg23567.html#msg23567) gestolpert, der mir weiter geholfen hat. (danke feargus)
So komm ich an meine 4 gesuchten Werte.
Forall Item In GetObject("winmgmts:{impersonationLevel=impersonate}").InstancesOf ("Win32_NetworkAdapterConfiguration")
Msgbox "IPaddress: " & Item.IPaddress(0)
Msgbox "IPsubnet: " & Item.IPsubnet(0)
Msgbox "DNSHostname: " & Item.DNSHostname(0)
Msgbox "MACAddress: " & Item.MACAddress(0)
Exit Forall
End Forall
Es ist zwar eine Blackbox, macht aber das, was ich möchte. (hoff ich)
Hier noch der Vollständigkeit halber eine JAVA Lösung:
package de.eknori.test;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.Enumeration;
public class NICInfo {
public static void main(String[] args) throws Exception {
try {
for (@SuppressWarnings("rawtypes")
Enumeration nis = NetworkInterface.getNetworkInterfaces(); nis
.hasMoreElements();) {
NetworkInterface ni = (NetworkInterface) nis.nextElement();
System.out.print("DisplayName : ");
System.out.println(ni.getDisplayName());
for (@SuppressWarnings("rawtypes")
Enumeration ias = ni.getInetAddresses(); ias.hasMoreElements();) {
InetAddress ia = (InetAddress) ias.nextElement();
System.out.print("HostName : ");
System.out.println(ia.getHostName());
System.out.print("IP Address : ");
System.out.println(ia.getHostAddress());
NetworkInterface network = NetworkInterface
.getByInetAddress(ia);
byte[] mac = network.getHardwareAddress();
System.out.print("MAC address : ");
StringBuilder sb = new StringBuilder();
for (int i = 0; i < mac.length; i++) {
sb.append(String.format("%02X%s", mac[i],
(i < mac.length - 1) ? "-" : ""));
}
System.out.println(sb.toString());
}
System.out.println("-------------------------");
}
} catch (SocketException e) {
e.printStackTrace();
} finally {
}
}
}
Erzeugt Ausgaben so wie diese:
-------------------------
DisplayName : Atheros AR8151 PCI-E Gigabit Ethernet Controller (NDIS 6.20)
HostName : castor
IP Address : 192.168.178.52
MAC address : 04-7D-7B-79-3D-5C
-------------------------