A
auldh
hello,
i have gotten my code running well. it collect the network card information
by way of Win32_networkadapterconfiguration but when it comes to the
DNSDomain output i'm get null. always null.
i run the ipconfig /all and there is data. but using the win32_... i get null.
int i = 0;
bool bStat = false;
ManagementObjectSearcher query = new ManagementObjectSearcher("SELECT * FROM
Win32_NetworkAdapterConfiguration WHERE IPEnabled = 'TRUE'");
ManagementObjectCollection queryCollection = query.Get();
i = queryCollection.Count;
string[] addresses;
foreach (ManagementObject snic in queryCollection)
{
XHF.defInst.xprhotfixviewer.Text += "NIC Name: " + "\t" +
snic["Description"] + "\r\n";
XHF.defInst.xprhotfixviewer.Text += "MAC Address: " + "\t" +
snic["MACAddress"] + "\r\n";
if (snic["IPAddress"] != null)
{
addresses = (string[])snic["IPAddress"];
foreach (string ipaddress in addresses)
{
XHF.defInst.xprhotfixviewer.Text += "IP Address: " + "\t" +
ipaddress + "\r\n";
}
}
else
XHF.defInst.xprhotfixviewer.Text += "IP Address: " + "\t";
XHF.defInst.xprhotfixviewer.Text += "DHCP Server: " + "\t" +
snic["DHCPServer"] + "\r\n";
XHF.defInst.xprhotfixviewer.Text += "DNS Domain: " + "\t" +
snic["DNSDomain"] + "\r\n";
according to documentation this is a "string".
i have gotten my code running well. it collect the network card information
by way of Win32_networkadapterconfiguration but when it comes to the
DNSDomain output i'm get null. always null.
i run the ipconfig /all and there is data. but using the win32_... i get null.
int i = 0;
bool bStat = false;
ManagementObjectSearcher query = new ManagementObjectSearcher("SELECT * FROM
Win32_NetworkAdapterConfiguration WHERE IPEnabled = 'TRUE'");
ManagementObjectCollection queryCollection = query.Get();
i = queryCollection.Count;
string[] addresses;
foreach (ManagementObject snic in queryCollection)
{
XHF.defInst.xprhotfixviewer.Text += "NIC Name: " + "\t" +
snic["Description"] + "\r\n";
XHF.defInst.xprhotfixviewer.Text += "MAC Address: " + "\t" +
snic["MACAddress"] + "\r\n";
if (snic["IPAddress"] != null)
{
addresses = (string[])snic["IPAddress"];
foreach (string ipaddress in addresses)
{
XHF.defInst.xprhotfixviewer.Text += "IP Address: " + "\t" +
ipaddress + "\r\n";
}
}
else
XHF.defInst.xprhotfixviewer.Text += "IP Address: " + "\t";
XHF.defInst.xprhotfixviewer.Text += "DHCP Server: " + "\t" +
snic["DHCPServer"] + "\r\n";
XHF.defInst.xprhotfixviewer.Text += "DNS Domain: " + "\t" +
snic["DNSDomain"] + "\r\n";
according to documentation this is a "string".