c# 获取 bios 序列号

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Management;
using System.Diagnostics;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            Debug.Print(getBiosSN());

        }

        public static string getBiosSN()
        {
            ManagementObjectSearcher searcher = new ManagementObjectSearcher("select * from Win32_BIOS");
            ManagementObjectCollection objects = searcher.Get();
            foreach (ManagementObject obj in objects)
            {
                try
                {
                    if (obj.GetPropertyValue("SerialNumber") != null)
                    {
                        return obj["SerialNumber"].ToString();
                    }
                }
                catch (Exception)
                {
                }
            }

            return string.Empty;
        }
    }
}

 

c# 获取 bios 序列号

上一篇:清除移动端输入框内的阴影


下一篇:iOS 苹果开发账号