VbScript獲取本地機器的硬體配置
'On Error Resume Next
Dim fso,f1
strComputer = "."
If Err.Description = "" Then
'收集計算機使用者資訊
Set objWmi = GetObject("winmgmts:" & strComputer & "rootcimv2")
'收集本地計算機名稱,若收集計算機登入帳戶的話則使用objItem.UserName
Set colItems = objWmi.ExecQuery("Select * from Win32_ComputerSystem", , 48)
J = 0
For Each objItem In colItems
'If J = 0 Then f1.write (Trim(objItem.Name)) Else f1.write ("," & Trim(objItem.Name))
'J = J + 1
computerName= Trim(objItem.name)
Next
''create filename as computername
'Set fso = CreateObject("Scripting.FileSystemObject")
'Set f1 = fso.CreateTextFile("c:" & computerName & ".txt")
'收集CPU資訊
'Set objWmi = GetObject("winmgmts:" & strComputer & "rootcimv2")
Set colItems = objWmi.ExecQuery("Select * from Win32_Processor", , 48)
J = 1
For Each objItem In colItems
'If J = 0 Then f1.write (Trim(objItem.Name)) Else f1.write ("," & Trim(objItem.Name))
'J = J + 1
wscript.echo "Cpu type:" & Trim(objItem.Name)
Next
'收集記憶體資訊
'收集記憶體總容量
'Set objWmi = GetObject("winmgmts:" & strComputer & "rootcimv2")
Set colItems = objWmi.ExecQuery("Select * from Win32_ComputerSystem", , 48)
J = 2
For Each objItem In colItems
'If J = 0 Then f1.write (Trim(objItem.TotalPhysicalMemory)) Else f1.write ("," & Trim(objItem.TotalPhysicalMemory))
'J = J + 1
wscript.echo "physical Memery:" & Round(Round(objItem.TotalPhysicalMemory/1024)) & " Mb"
Next
'收集記憶體外頻和數量資訊
'Set objWmi = GetObject("winmgmts:" & strComputer & "rootcimv2")
'Set colItems = objWmi.ExecQuery("Select * from Win32_PhysicalMemory", , 48)
'J = 3
'For Each objItem In colItems
'If J = 0 Then f1.write (Trim(objItem.Description) & (objItem.DeviceLocator) & (objItem.Speed)) Else f1.write ("," & Trim(objItem.Description) & (objItem.DeviceLocator) & "," & Trim(objItem.Speed))
'J = J + 1
'wscript.echo "Cpu type:" & objItem.Name
'Next
'收集顯示卡資訊
'Set objWmi = GetObject("winmgmts:" & strComputer & "rootcimv2")
Set colItems = objWmi.ExecQuery("Select * from Win32_VideoController", , 48)
J = 4
For Each objItem In colItems
'If J = 0 Then f1.write (Trim(objItem.Caption) & (objItem.VideoModeDescription)) Else f1.write ("," & Trim(objItem.Caption) & (objItem.VideoModeDescription))
'J = J + 1
wscript.echo "VideoController:" & objItem.Caption
Next
'收集硬碟基本資訊
'Set objWmi = GetObject("winmgmts:" & strComputer & "rootcimv2")
Set colItems = objWmi.ExecQuery("Select * from Win32_DiskDrive", , 48)
J = 5
For Each objItem In colItems
'If J = 0 Then f1.write (Trim(objItem.Caption) & (objItem.Size)) Else f1.write ("," & Trim(objItem.Caption) & "," & (objItem.Size))
'J = J + 1
wscript.echo "HardDisk :" & objItem.Caption &" HardDisk Size: " & Round(Round(Round(objItem.Size/1000)/1000)/1000) & " G"
Next
'收集音效卡資訊
'Set objWmi = GetObject("winmgmts:" & strComputer & "rootcimv2")
Set colItems = objWmi.ExecQuery("Select * from Win32_SoundDevice", , 48)
J = 6
For Each objItem In colItems
'If J = 0 Then f1.write (Trim(objItem.ProductName)) Else f1.write ("," & Trim(objItem.ProductName))
'J = J + 1
wscript.echo "SoundCard:" & objItem.productName
Next
'收集網路卡資訊
'Set objWmi = GetObject("winmgmts:" & strComputer & "rootcimv2")
Set colItems = objWmi.ExecQuery("Select * from Win32_NetworkAdapter ", , 48)
For Each objItem In colItems
'If J = 0 Then f1.write (Trim(objItem.Description) & (objItem.MACAddress)) Else f1.write ("," & Trim(objItem.ProductName) & "," & (objItem.MACAddress))
'J = J + 1
wscript.echo "NetWorkCard:" & Trim(objItem.Description) & " Mac Address:" & Trim(objItem.MAcaddress)
Next
'收集軟碟機資訊
'Set objWmi = GetObject("winmgmts:" & strComputer & "rootcimv2")
Set colItems = objWmi.ExecQuery("Select * from Win32_FloppyDrive", , 48)
J = 8
For Each objItem In colItems
'If J = 0 Then f1.write (Trim(objItem.Caption)) Else f1.write ("," & Trim(objItem.Caption))
'J = J + 1
wscript.echo "Floppy Driver:" & Trim(objItem.Caption)
Next
'收集CDROM資訊
'Set objWmi = GetObject("winmgmts:" & strComputer & "rootcimv2")
Set colItems = objWmi.ExecQuery("Select * from Win32_CDROMDrive", , 48)
J = 9
For Each objItem In colItems
'If J = 0 Then f1.write (Trim(objItem.Name)) Else f1.write ("," & Trim(objItem.Name))
'J = J + 1
wscript.echo "Dvd Driver:" & Trim(objItem.Name)
Next
End If
'f1.WriteLine ("")
'f1.Close
'Set f1=Nothing
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/77544/viewspace-1009913/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- c#獲取機器硬體資訊C#
- java Socket 獲取本地主機ipJava
- Android獲取硬體裝置資訊Android
- C++獲取硬體相關資訊C++
- vmi:獲取 windows 系統硬體資訊Windows
- 【VMware ESXi】使用 smbiosDump 命令獲取伺服器硬體資訊。iOS伺服器
- js獲取瀏覽器資訊和客戶端硬體資訊(一)JS瀏覽器客戶端
- Android硬體點陣圖填坑之獲取硬體畫布Android
- 用C#獲取電腦硬體資訊C#
- python獲得本機硬體資訊Python
- Inxi:獲取Linux系統和硬體資訊的神器Linux
- golang gopsutil 程式 系統硬體資訊 獲取Golang
- 低版本的51degrees.mobi 1.2.0.5 用UserAgent獲取手機硬體型號,並升級最新的WURFL硬體包...
- Android獲取手機配置資訊Android
- 伺服器的硬體配置構成有哪些?伺服器
- 機器人的「語料」,如何獲取?機器人
- 獲取本地的IP地址(內網)內網
- 【知識分享】伺服器的硬體配置都有哪些伺服器
- 如何選擇Web伺服器硬體配置?Web伺服器
- 計算機的硬體系統儲存器計算機
- VMware虛擬機器獲取教程虛擬機
- Telegram 聊天機器人中獲取照片機器人
- 獲取配置的mock地址Mock
- 獲取本地圖片/視訊地圖
- java Properties獲取本地檔案的變數Java變數
- 獲取本地IP和mac等資訊Mac
- 對Spark硬體配置的建議Spark
- hyperic-sigar-1.6.4 java獲取軟硬體相關資訊Java
- 透過硬體識別符號獲取過程映像輸入符號
- 【知識分享】伺服器硬體配置如何選擇伺服器
- 本地訪問虛擬機器(Vmware)環境下配置的域名虛擬機
- java獲取硬碟根目錄的本地路徑Java硬碟
- 關於java獲取本地ip的幾種方法Java
- 計算機的硬體與軟體計算機
- 獲取windows 作業系統下的硬體或作業系統資訊等Windows作業系統
- Azure File Storage(一)為本地機器配置網路磁碟
- javascript獲取本地時間日期程式碼JavaScript
- C#獲取本地串列埠裝置C#串列埠