You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public static ArrayList get_ips()
{
var datasets = new ArrayList();
var scope = new ManagementScope(Functions.GetServerName());
var query = new SelectQuery("Select Caption, IPAddress, MACAddress From Win32_NetworkAdapterConfiguration WHERE IPEnabled = 'TRUE'");
var searcher = new ManagementObjectSearcher(scope, query);
var count = 0; //-> fake adapter name
foreach (var x in searcher.Get())
{
var dataset = new ArrayList();
var ips = (string[])x["IPAddress"];
dataset.Add("eth" + count); //x["Caption"]
dataset.Add(ips[0]); //-> IP v4
dataset.Add(ips.Length > 1 ? ips[1] : "N/A"); <<<<< ----- -THis works better
dataset.Add(x["MACAddress"]); //-> Mac address
datasets.Add(dataset);
count++;
}
return datasets;
}
The text was updated successfully, but these errors were encountered:
public static ArrayList get_ips()
{
var datasets = new ArrayList();
The text was updated successfully, but these errors were encountered: