有些机器下读取不到硬盘序列号,请教高手怎么写能在xp、windows server2003、windows7下都可以读取到硬盘序列号,
现在在有些xp下读取不到,在windows server2003下读取不到,读取到的都是空的。            Key = "Win32_PhysicalMedia";
            String HDid;
            ManagementClass cimobject = new ManagementClass(Key);
            ManagementObjectCollection moc = cimobject.GetInstances();
            foreach (ManagementObject mo in moc)
            {
                foreach (PropertyData PC in mo.Properties)
                {
                    string temp1 = PC.Value as string;
                    if (!string.IsNullOrEmpty(temp1))
                    {
                        temp1 = temp1.Trim();
                        Console.WriteLine("name:[" + PC.Name + "] value:[" + temp1+ "] value len:" + temp1.Length.ToString());
                    }
                }
            }