MaxScript And DotNet 获取硬件信息
MaxScriptMAX脚本 4782 19
实名

通过了实名认证的内容创造者

发布于 2013-9-11 20:14:29

您需要 登录 才可以下载或查看,没有账号?注册

x
本帖最后由 大西几 于 2020-12-17 21:47 编辑
  1. Fn  GetHardwareInfo HwClass HwProp  =
  2. (
  3.     local HwInfo,HwInfoEnumerator,OutArray
  4.     OutArray = #()
  5.     try
  6.     (
  7.         HwInfo = (DotNetObject "System.Management.ManagementClass" HwClass).GetInstances()
  8.     )
  9.     catch
  10.     (
  11.         DotNet.LoadAssembly  "System.Management.dll"
  12.         HwInfo = (DotNetObject "System.Management.ManagementClass" HwClass).GetInstances()
  13.     )
  14.     HwInfoEnumerator = HwInfo.GetEnumerator()
  15.     while (HwInfoEnumerator.MoveNext())  do
  16.     (
  17.         local TempString =  HwInfoEnumerator.Current.Item[HwProp] as string
  18.         if TempString != "" do append OutArray TempString
  19.     )
  20.     OutArray
  21. )

  22. Fn GetHardwareClassInfo HwClass =
  23. (
  24.     local HwInfo,HwInfoEnumerator,OutArray
  25.     OutArray = #()
  26.     try
  27.     (
  28.         HwInfo = (DotNetObject "System.Management.ManagementClass" HwClass).GetInstances()
  29.     )
  30.     catch
  31.     (
  32.         DotNet.LoadAssembly  "System.Management.dll"
  33.         HwInfo = (DotNetObject "System.Management.ManagementClass" HwClass).GetInstances()
  34.     )
  35.   
  36.     HwInfoEnumerator = HwInfo.GetEnumerator()
  37.     while (HwInfoEnumerator.MoveNext())  do
  38.     (
  39.         PropEnumerator = HwInfoEnumerator.Current.Properties.GetEnumerator()
  40.         while (PropEnumerator.MoveNext()) do
  41.             (
  42.                 local TempString = PropEnumerator.Current.Name as string
  43.                 if TempString != "" do append OutArray TempString
  44.             )
  45.     )
  46.     OutArray
  47. )

  48. GetHardwareClassInfo "Win32_Processor" --获取相应类别的属性列表,此处获取的是Cpu

  49. GetHardwareInfo  "Win32_Processor"  "ProcessorID" --获取CpuID
  50. GetHardwareInfo "Win32_PhysicalMedia"  "SerialNumber" --获取硬盘序列号
  51. GetHardwareInfo "Win32_DiskDrive" "Model"   --获取硬盘名称
点击此处复制文本
image.png
image.png

评分

参与人数 1活跃度 +4 展开 理由
lwmm + 4 【给力】阅贴无数,楼主最强!

查看全部评分

我的帖子不喜欢无意义的自动回复,如有疑问可加好友私聊或留言
使用道具 <
iohoi  发表于 2013-11-6 16:28:27  
2#
没看完~~~~~~ 先顶,好同志
回复 收起回复
使用道具
protoss  发表于 2014-1-10 13:46:43  
3#
要是能加点中文说明就好啦!
回复 收起回复
使用道具
zhouyan1033  发表于 2014-7-10 06:59:12  
4#
膜拜神贴,后面的请保持队形~
回复 收起回复
使用道具
ren9616  发表于 2014-7-11 11:14:56  
5#
hao
回复 收起回复
使用道具
看什么看  发表于 2014-7-27 23:28:35  
6#
这是要逆天的节奏啊!
回复 收起回复
使用道具
MAN  发表于 2014-7-28 19:20:43  
7#
立刻提起了精神
回复 收起回复
使用道具
assdfg  发表于 2015-4-5 22:09:41  
8#

土豪,我们做朋友吧!
回复 收起回复
使用道具
an.kcj  发表于 2015-10-15 21:36:35  
9#
顶~~~
回复 收起回复
使用道具
gemini8023  发表于 2015-12-13 09:09:35  
11#
天下武功出少林,世界资源入元素!
回复 收起回复
使用道具
pingjingxinqing  发表于 2015-12-13 11:45:13  
12#
zhouyan1033 发表于 2014-7-10 06:59
膜拜神贴,后面的请保持队形~

首发必需微元素,荣耀加身装备酷!
回复 收起回复
使用道具
老h马  发表于 2017-2-21 09:59:39  
13#
不错 学习了
回复 收起回复
使用道具
baiyun  发表于 2017-10-31 17:12:52  
14#
有点看不懂
回复 收起回复
使用道具
qq_皮皮怪_eQq  发表于 2018-10-20 14:18:28  
15#
元素那么大,我想来看看!
回复 收起回复
使用道具
HXDD12  发表于 2018-10-26 11:10:54  
16#
回复 收起回复
使用道具
建模大人  发表于 2018-10-27 16:46:32  
17#
感谢楼主分享
回复 收起回复
使用道具
ud_terry  发表于 2018-10-28 15:53:30  
18#
给力!元素有你更精彩
回复 收起回复
使用道具
qq_老卢_Xcz  发表于 2019-12-8 17:53:36  
19#
感谢,,复制留名
回复 收起回复
使用道具
神佛之上  发表于 2022-11-22 22:11:02  
20#
给力!元素有你更精彩
回复 收起回复
使用道具
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表