Javascript hard drive serial number + other hardware information

Source: Internet
Author: User

I looked at other materials, including CPU extraction and Mac off-the-shelf. Code But there is no hard disk serial number. After searching for a long time, we can find the parameter for extracting the hard disk serial number. So I made it up.
<HTML>
<Head>
<Title> extract the hard drive serial number </title>
<SCRIPT>
Function disk () {// hard disk serial number
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> ");
}
Document. Write ("</table> ");
}
</SCRIPT>
</Head>
<Body>
<Input type = "button" value = "hard disk serial number" onclick = "disk ()">
</Body>
</Html>

The code found here:
For ASP or. net users, through ASP or. net Language to obtain client hardware information is very familiar. but how can I obtain client information through a client script such as JavaScript? See the following example:
<! Doctype HTML public "-// W3C // dtd html 4.0 transitional // en">
<HTML>
<Head>
<Title> JavaScript obtains client hardware information -www.web2bar.cn/</title>
<Meta name = "generator" content = "Microsoft Visual Studio. NET
7.1 ">
<Meta name = "vs_targetschema"
Content = "http://schemas.microsoft.com/intellisense/ie5">
<SCRIPT id = clienteventhandlersjs Language = JavaScript>
<! --

Function button2_onclick () {// CPU Information
VaR locator = new activexobject ("wbemscripting. swbemlocator ");
VaR service = locator. connectserver (".");
VaR properties = service. execquery ("select * From win32_processor ");
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. Caption + "</TD> ");
Document. Write ("<TD>" + P. DeviceID + "</TD> ");
Document. Write ("<TD>" + P. Name + "</TD> ");
Document. Write ("<TD>" + P. cpustatus + "</TD> ");
Document. Write ("<TD>" + P. Availability + "</TD> ");
Document. Write ("<TD>" + P. Level + "</TD> ");
Document. Write ("<TD>" + P. processorid + "</TD> ");
Document. Write ("<TD>" + P. systemname + "</TD> ");
Document. Write ("<TD>" + P. processortype + "</TD> ");
Document. Write ("</tr> ");
}
Document. Write ("</table> ");
}

Function button1_onclick () {// floppy disk Information
VaR locator = new activexobject ("wbemscripting. swbemlocator ");
VaR service = locator. connectserver (".");
VaR properties = service. execquery ("select * From win32_floppydrive ");
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. Description + "</TD> ");
Document. Write ("<TD>" + P. DeviceID + "</TD> ");
Document. Write ("<TD>" + P. Status + "</TD> ");
Document. Write ("<TD>" + P. manufacuturer + "</TD> ");
Document. Write ("</tr> ");
}
Document. Write ("</table> ");
}

Function button1_onclick () {// CD-ROM Information
VaR locator = new activexobject ("wbemscripting. swbemlocator ");
VaR service = locator. connectserver (".");
VaR properties = service. execquery ("select * From win32_cdromdrive ");
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. Caption + "</TD> ");
Document. Write ("<TD>" + P. Description + "</TD> ");
Document. Write ("<TD>" + P. Drive + "</TD> ");
Document. Write ("<TD>" + P. Status + "</TD> ");
Document. Write ("<TD>" + P. medialoaded + "</TD> ");
Document. Write ("</tr> ");
}
Document. Write ("</table> ");
}

Function button1_onclick () {// keyboard Information
VaR locator = new activexobject ("wbemscripting. swbemlocator ");
VaR service = locator. connectserver (".");
VaR properties = service. execquery ("select * From win32_keyboard ");
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. Description + "</TD> ");
Document. Write ("<TD>" + P. Name + "</TD> ");
Document. Write ("<TD>" + P. Status + "</TD> ");
Document. Write ("</tr> ");
}
Document. Write ("</table> ");
}

Function button1_onclick () {// motherboard Information
VaR locator = new activexobject ("wbemscripting. swbemlocator ");
VaR service = locator. connectserver (".");
VaR properties = service. execquery ("select * From win32_baseboard ");
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. hostingboard + "</TD> ");
Document. Write ("<TD>" + P. Manufacturer + "</TD> ");
Document. Write ("<TD>" + P. poweredon + "</TD> ");
Document. Write ("<TD>" + P. Product + "</TD> ");
Document. Write ("<TD>" + P. serialnumber + "</TD> ");
Document. Write ("<TD>" + P. Version + "</TD> ");
Document. Write ("</tr> ");
}
Document. Write ("</table> ");
}

// -->
</SCRIPT>
</Head>
<Body>
<Input id = "button1" type = "button" value = "button"
Name = "button1" Language = JavaScript onclick = "Return button1_onclick ()">
</Body>
</Html>
The main advantage of using JavaScript to obtain client information is that you do not need server resources, you do not need to refresh the webpage, And you can directly execute scripts on the client for display.

The hard disk serial number parameter is found here:
\ 'Obtain the hard disk serial number
Dim cmicwmi as new system. Management. managementobjectsearcher (\ "select * From win32_diskdrive \")
Dim uint32 as uint32
For each cmicwmiobj as managementobject in cmicwmi. Get
Uint32 = cmicwmiobj (\ "signature \")
Next
Textbox1.text = uint32.tostring
And finally proposed in one piece, huh, huh.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.