如何搜集企业域中所有电脑的硬件配置信息?

2015/02/09 23:19
阅读数 559
  如何搜集企业域中所有电脑的硬件配置信息?
 
家好,好久�有在��大伙留言了。最近在忙著做��管理�一��。����多,配置不一,做����有些�。不��有�系,最近找到了一��本可以做到用�端自�收集配置信息的�本。主要包括有CPU、MAC、IP、�存、硬�、�卡、�示卡、光�、主板信息不是很全。下面我把�本公布一下:(在此�明,���本�自企��盟,很久以前下的)
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=" \\你的服�器地址\hard_info\ "& computername &".txt"
set tempfile=fso.createtextfile(tempfilter)
strComputer = "."
Set objWMIService = Getobject("winmgmts:\\" & strComputer & "\root\cimv2")
 
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 & "\root\cimv2")
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_NetworkAdapterConfiguration 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)
中�的注�被我��掉了,因�公司是繁�系�����的。�人�得���是不�的,�需要在服�器上新建一�共享文件��置可��限,使用�策略配合使用功力大增。
我已在���境�真��境中���,�有什���。如果大家下�後��不能使用或是有其他���回�,希望可以�你共同探��方面的知�。��!
展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部