概述
原文地址:获取域内计算机硬件信息的VBS脚本内容作者:kevin
On Error Resume Next
temp=0
set wshshell=wscript.createobject("wscript.shell")
wshshell.run ("%comspec% /c regsvr32 /s scrrun.dll"),0,True
wshshell.run ("%comspec% /c sc config winmgmt start= auto"),0,True
wshshell.run ("%comspec% /c net start winmgmt"),0
Set WshNetwork = WScript.Createobject("WScript.Network")
computername=WshNetwork.ComputerName
set fso=createobject("scripting.filesystemobject")
tempfilter="srvinfo"& computername &".txt"
set tempfile=fso.createtextfile(tempfilter)
strComputer = "."
Set objWMIService = Getobject("winmgmts:" & strComputer & "rootcimv2")
set board =objwmiservice.execQuery("select * from win32_baseboard")
for each item in board
board2= item.Product
next
'CPU
set cpu =objwmiservice.execQuery("select * from win32_processor")
for each item in cpu
cpu2= item.Name
next
Set colItems = objWMIService.ExecQuery("Select * from Win32_PhysicalMemory",,48)
For Each objItem in colItems
a=objitem.capacity/1048576
temp=temp+objitem.capacity
n=n+1
Next
memory=temp/1048576
if n=1 then
memory2= n & "條" &a& "M"
else
memory2= n & "條" &a& "M"&" 合計"&memory&"M"
end if
'sound
set sound =objwmiservice.execQuery("select * from win32_SoundDevice",,48)
for each item in sound
sound2= item.ProductName
next
'OS
set OS =objwmiservice.execQuery("select * from win32_OperatingSystem",,48)
for each item in OS
OS2= item.Caption & item.Version
next
Set objWMIService = GetObject("winmgmts:" & strComputer & "rootcimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_CDROMDrive", , 48)
J = 0
For Each objItem In colItems
If J = 0 Then CDROM2 = (Trim(objItem.Name)) Else CDROM3 = (Trim(objItem.Name))
J = J + 1
Next
Set colItems = objWMIService.ExecQuery("Select * from Win32_NetworkAdapter", , 48)
J = 0
For Each objItem In colItems
If J = 0 Then lan1= (Trim(objItem.ProductName)) Else lan2= (Trim(objItem.ProductName))
J = J + 1
Next
Set colItems = objWMIService.ExecQuery("Select * from Win32_NetworkAdapter", , 48)
J = 0
For Each objItem In colItems
If J = 0 Then lan3= (Trim(objItem.MACAddress)) Else lan4= (Trim(objItem.MACAddress))
J = J + 1
Next
Set colItems = objWMIService.ExecQuery("Select * from Win32_DiskDrive", , 48)
J = 0
For Each objItem In colItems
If J = 0 Then disk2= (Trim(objItem.Caption)) Else disk3= ( Trim(objItem.Caption))
J = J + 1
Next
Set colItems = objWMIService.ExecQuery("Select * from Win32_VideoController", , 48)
J = 0
For Each objItem In colItems
If J = 0 Then video2 = (Trim(objItem.Caption) & (objItem.VideoModeDescription)) Else video3 = (Trim(objItem.Caption) & (objItem.VideoModeDescription))
J = J + 1
Next
set colItems =objWMIService.ExecQuery _
("Select IPAddress from Win32_NetworkAdapterConfigurat ion where IPEnabled=TRUE")
For Each IPConfig IN colItems
If Not IsNull(IPConfig.IPAddress) Then
For i=LBound(IPConfig.IPAddress) To UBound(IPConfig.IPAddress)
lan5= (IPConfig.IPAddress(i))
Next
End If
Next
tempfile.writeline(lan1)
tempfile.writeline(lan3)
tempfile.writeline(lan5)
tempfile.writeline(board2)
tempfile.writeline(cpu2)
tempfile.writeline(memory2)
tempfile.writeline(disk2)
tempfile.writeline(video2)
tempfile.writeline(sound2)
tempfile.writeline(OS2)
tempfile.writeline(CDROM2)
tempfile.writeline(lan2)
tempfile.writeline(lan4)
tempfile.writeline(disk3)
tempfile.writeline(video3)
tempfile.writeline(CDROM3)
temp=0
set wshshell=wscript.createobject("wscript.shell")
wshshell.run ("%comspec% /c regsvr32 /s scrrun.dll"),0,True
wshshell.run ("%comspec% /c sc config
wshshell.run ("%comspec% /c net start winmgmt"),0
Set WshNetwork = WScript.Createobject("WScript.Network")
computername=WshNetwork.ComputerName
set fso=createobject("scripting.filesystemobject")
tempfilter="srvinfo"& computername &".txt"
set tempfile=fso.createtextfile(tempfilter)
strComputer = "."
Set objWMIService = Getobject("winmgmts:" & strComputer & "rootcimv2")
set board =objwmiservice.execQuery("select * from win32_baseboard")
for each item in board
board2=
next
'CPU
set cpu =objwmiservice.execQuery("select * from win32_processor")
for each item in cpu
cpu2=
next
Set colItems = objWMIService.ExecQuery("Select * from Win32_PhysicalMemory",,48)
For Each objItem in colItems
a=objitem.capacity/1048576
temp=temp+objitem.capacity
n=n+1
Next
memory=temp/1048576
if n=1 then
memory2=
else
memory2=
end if
'sound
set sound =objwmiservice.execQuery("select * from win32_SoundDevice",,48)
for each item in sound
sound2= item.ProductName
next
'OS
set OS =objwmiservice.execQuery("select * from win32_OperatingSystem",,48)
for each item in OS
OS2= item.Caption & item.Version
next
Set objWMIService = GetObject("winmgmts:" & strComputer & "rootcimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_CDROMDrive", , 48)
Set colItems = objWMIService.ExecQuery("Select * from Win32_NetworkAdapter", , 48)
Next
Set colItems = objWMIService.ExecQuery("Select * from Win32_NetworkAdapter", , 48)
Next
Set colItems = objWMIService.ExecQuery("Select * from Win32_DiskDrive", , 48)
Next
Set colItems = objWMIService.ExecQuery("Select * from Win32_VideoController", , 48)
Next
set colItems =objWMIService.ExecQuery _
tempfile.writeline(lan1)
tempfile.writeline(lan3)
tempfile.writeline(lan5)
tempfile.writeline(board2)
tempfile.writeline(cpu2)
tempfile.writeline(memory2)
tempfile.writeline(disk2)
tempfile.writeline(video2)
tempfile.writeline(sound2)
tempfile.writeline(OS2)
tempfile.writeline(CDROM2)
tempfile.writeline(lan2)
tempfile.writeline(lan4)
tempfile.writeline(disk3)
tempfile.writeline(video3)
tempfile.writeline(CDROM3)
最后
以上就是细腻夏天为你收集整理的获取域内计算机硬件信息的VBS脚本内容的全部内容,希望文章能够帮你解决获取域内计算机硬件信息的VBS脚本内容所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复