vb脚本怎么获取windows机器的相关温度

王者_来归 2016-09-28 10:47:54
如题,请教一下,使用vb脚本,如何获取到windows机器的相关温度?类似于鲁大师那样,可以得出温度信息。
如果有相关的文章,麻烦给出一个链接,如果有现成的代码,还望能够给出。非常感谢!
...全文
724 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
一笑拔剑 2016-10-06
  • 打赏
  • 举报
回复
有接口的 NV卡有NV卡的接口 A卡有A卡的接口 一般硬盘倒是统一接口smart VBS这个代码CSDN博客里我看到过.

'Verison:        WSH 5.8
'Platform:       WinXP/Vista/WIN7
'Author:         Ken Hua (hua.ken@inventec.com.cn)
'
' Script Function:
'   Get Hard Disk S.M.A.R.T information
'

'On Error Resume Next
'Option Explicit

Const Start_Stop_Count = 4      'A tally of spindle start/stop cycles.
Const Power_On_Hours = 9        'Count of hours in power-on state.  
Const Temperature = 194          'Current internal temperature.  


Dim i,j,k,items(100),threshold(100),smartdata(2,11)
Dim Description(2),Limit(2),Normal(2),Bad(2),Data(2),getInfo(2)
Dim strComputer,objWMIService,colItems,objItem

strComputer = "."
getInfo(0) = Start_Stop_Count
getInfo(1) = Power_On_Hours
getInfo(2) = Temperature


Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\WMI")
Set colItems = objWMIService.ExecQuery("SELECT * FROM MSStorageDriver_FailurePredictThresholds",,48)  
 For Each objItem In colItems      
  j = 0
  For i = 2 To UBound(objItem.VendorSpecific, 1) Step 12
   items(j) = objItem.VendorSpecific(i)
   threshold(j) = objItem.VendorSpecific(i+1)
                 j = j + 1
  Next
 Next 
   
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\WMI")
Set colItems = objWMIService.ExecQuery("SELECT * FROM MSStorageDriver_ATAPISmartData",,48) 
 For Each objItem In colItems      
  For i = 2 To UBound(objItem.VendorSpecific, 1) Step 12
                 If objItem.VendorSpecific(i) = getInfo(0) Then
                  k = i
                  For j = 0 To 11
                   smartdata(0,j) = objItem.VendorSpecific(k)
                   k = k + 1
                  Next 
                 End If
                 If objItem.VendorSpecific(i) = getInfo(1) Then
                  k = i
                  For j = 0 To 11
                   smartdata(1,j) = objItem.VendorSpecific(k)
                   k = k + 1
                  Next 
                 End If
                 If objItem.VendorSpecific(i) = getInfo(2) Then
                  k = i
                  For j = 0 To 11
                   smartdata(2,j) = objItem.VendorSpecific(k)
                   k = k + 1
                  Next 
                 End If
                Next                                
 Next

 For i = 0 To 100
  If items(i) = getInfo(0) Then
   Limit(0) = threshold(i)
  End If
  If items(i) = getInfo(1) Then
   Limit(1) = threshold(i)
  End If
  If items(i) = getInfo(2) Then
   Limit(2) = threshold(i)
  End If
 Next
 
 Description(0) = "Start/Stop Count"
 Description(1) = "Power On Hours"
 Description(2) = "Temperature" 
  
 Normal(0) = smartdata(0,3)
 Normal(1) = smartdata(1,3)
 Normal(2) = smartdata(2,3)
   
 Bad(0) = smartdata(0,4)
 Bad(1) = smartdata(1,4)
 Bad(2) = smartdata(2,4)
 
 Data(0) = (Int(smartdata(0,7))*16*16*16)+(Int(smartdata(0,6))*16*16)+Int(smartdata(0,5))
 Data(1) = (Int(smartdata(1,7))*16*16*16)+(Int(smartdata(1,6))*16*16)+Int(smartdata(1,5))
 Data(2) = (Int(smartdata(2,7))*16*16*16)+(Int(smartdata(2,6))*16*16)+Int(smartdata(2,5))

       Wscript.echo "Hard Disk S.M.A.R.T                                 -- Hua.ken@Inventec.com.cn    " & vbCrLf _
                   &"----------------------------------------------------------------------------------" & vbCrLf _
                   &" Description(ID)   Threshold_Limit      Normal      Bad        Data               " & vbCrLf _  
                   &"----------------------------------------------------------------------------------" & vbCrLf _ 
                   & Description(0) & "(" & getInfo(0) & ")" & Space(7) & Limit(0) & Space(16) & Normal(0) & Space(12) & Bad(0) & Space(12) & Data(0) & vbCrLf _ 
                   & Description(1) & "(" & getInfo(1) & ")" & Space(7) & Limit(1) & Space(17) & Normal(1) & Space(13) & Bad(1) & Space(13) & Data(1) & vbCrLf _ 
                   & Description(2) & "(" & getInfo(2) & ")" & Space(9) & Limit(2) & Space(17) & Normal(2) & Space(13) & Bad(2) & Space(13) & Data(2)
Wscript.Quit
代码来源地址 http://blog.csdn.net/u014183302/article/details/41289451
赵4老师 2016-09-30
  • 打赏
  • 举报
回复
引用 7 楼 sen_linzhiwang 的回复:
不知道鲁大师不知道怎么获取的,我这里有很多机器,不可能每台上都装个鲁大师。
引用 6 楼 zhao4zhong1 的回复:
CreateDesktop创建一个桌面,让鲁大师运行在这个隐藏桌面上,你再从鲁大师的界面上获取温度。
试试用APIMonitor或APIOverride软件监视鲁大师获取温度的过程。
王者_来归 2016-09-30
  • 打赏
  • 举报
回复
不知道鲁大师不知道怎么获取的,我这里有很多机器,不可能每台上都装个鲁大师。
引用 6 楼 zhao4zhong1 的回复:
CreateDesktop创建一个桌面,让鲁大师运行在这个隐藏桌面上,你再从鲁大师的界面上获取温度。
舉杯邀明月 2016-09-29
  • 打赏
  • 举报
回复
引用 3 楼 sysdzw 的回复:
这种依赖硬件的,应该有接口的吧。不然那些软件怎么得到温度的
底层接口,未公开………………
赵4老师 2016-09-29
  • 打赏
  • 举报
回复
CreateDesktop创建一个桌面,让鲁大师运行在这个隐藏桌面上,你再从鲁大师的界面上获取温度。
of123 2016-09-29
  • 打赏
  • 举报
回复
与主板相关,它提供传感器以及对系统的接口。现在的情况不了解,以前是一部分主板具有这样的功能。
无·法 2016-09-28
  • 打赏
  • 举报
回复
这种依赖硬件的,应该有接口的吧。不然那些软件怎么得到温度的
舉杯邀明月 2016-09-28
  • 打赏
  • 举报
回复
这个有点难度。 wmi 并不完全可靠……
一如既往哈 2016-09-28
  • 打赏
  • 举报
回复
试试wmi.................

7,763

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧