如何获得系统信息 [英] how to get system information

查看:54
本文介绍了如何获得系统信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

先生

我需要代码,以使我的个人计算机系统信息和操作系统的许可密钥在浏览器上显示,或使用.net以字符串格式显示.

所以请帮帮我


我得到了所有其他信息,但仍然没有得到我想要的摩托女巫.

我拥有XP Os的原始副本,因此,我希望使用.net
我的PC的产品密钥.

请帮帮我!


sir

i want code in that my personal computer system information and liecence key of my Operating system display on browser or in string format using .net

so please help me


i get every other information but still i didnt get my moto witch i want.

i hav leagal copy of XP Os so,i want product key of my pc using .net

please help me !


using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Management;
using System.Management.Instrumentation;
using Microsoft.Win32;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        GetCPUData();
    }
    public void GetCPUData()
    {
       

       
        System.Text.StringBuilder sb = new System.Text.StringBuilder();

        String cpuName = string.Empty;

        ManagementObjectSearcher searcher = new
            ManagementObjectSearcher("select * from Win32_Processor");
        foreach (ManagementObject o in searcher.Get())
        {
            sb.AppendFormat("{0}<p/>", o.ToString());

            foreach (PropertyData prop in o.Properties)
            {
                sb.AppendFormat("Name: {0} Value : {1}<br/>", prop.Name, prop.Value);
                if (prop.Name == "Name")
                    cpuName = (String)prop.Value;
            }
        }

        sb.Insert(0, String.Format("<h3>{0}</h3>", cpuName));
        
        Response.Write(sb.ToString());
        OSlabel1.Text = System.Environment.OSVersion.ToString();
        OSVersionlabel1.Text = System.Environment.Version.ToString();


    


        RegistryKey Rkey = Registry.LocalMachine;
        Rkey = Rkey.OpenSubKey("HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0");
        CPUInfolabel1.Text = (string)Rkey.GetValue("ProcessorNameString");

        oskey.Text = System.Environment.SystemDirectory.ToString();
        
    }
}

推荐答案

这些链接将指导您获取SYS信息

1. 如何获取硬件信息(CPU ID,主板信息,硬盘序列号,系统信息...) [ http://social.msdn.microsoft .com/forums/zh-CN/Vsexpressvcs/thread/4b61e98​​e-568d-4175-bb7b-d7e33466d90b/ [ http://geekswithblogs.net/willemf/archive/2006/04/23/76125.aspx [^ ]
These links will guide to get SYS Info

1. How To Get Hardware Information (CPU ID, MainBoard Info, Hard Disk Serial, System Information , ...)[^]

2. http://social.msdn.microsoft.com/forums/en-US/Vsexpressvcs/thread/4b61e98e-568d-4175-bb7b-d7e33466d90b/[^]

And reg OS Lic Key this link may help you:

http://geekswithblogs.net/willemf/archive/2006/04/23/76125.aspx[^]


看看Win32_OperatingSystem ^ ].
它应该为您提供所需的所有详细信息.
Have a look at the Win32_OperatingSystem class[^].
It should give you all the details you need.


这篇关于如何获得系统信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆