var locator = new ActiveXObject ("WbemScripting.SWbemLocator");
var service = locator.ConnectServer(".");
var properties = service.ExecQuery("SELECT * FROM Win32_DiskDrive");
var e = new Enumerator (properties);
document.write("<table border=1>");
for (;!e.atEnd();e.moveNext ())
{
var p = e.item ();
document.write("<tr>");
document.write("<td>" + p.signature + "</td>");
document.write("</tr>");
}
網上大部分是這樣寫的 但是獲取的不對 大部分台式機根本獲取不到 大家有什麼好辦法嗎?
var locator = new ActiveXObject("WbemScripting.SWbemLocator");
var service = locator.ConnectServer(".");
var properties = service.ExecQuery("SELECT * FROM Win32_PhysicalMedia");
var e = new Enumerator(properties);
document.write("<table border=1>");
for (; !e.atEnd() ; e.moveNext()) {
var p = e.item();
if (p.SerialNumber) {
document.write("<tr>");
document.write("<td>" + p.SerialNumber + "</td>");
document.write("</tr>");
}
}