标题: [转贴] VBS脚本获取远程计算机硬件信息 [打印本页]
作者: VBScript 时间: 2012-4-7 22:18 标题: VBS脚本获取远程计算机硬件信息
- 'on error resume next
- Dim WMI
- Dim sAns
- Dim Computer
- strComputer = InputBox("Enter Full Device Name", "Getting your Infos")
- '-------------------------------------------------------------------
- Set WMI = GetObject("WinMgmts:\\" & strComputer)
- Set objs = WMI.InstancesOf("Win32_Computersystem")
- for Each obj In objs
- model = obj.Model
- memory = obj.totalphysicalmemory
- USER = obj.UserName
- Computer = obj.Name
- domain = obj.domain
- Next
- if memory > 1024 then
- memory=memory/1024
- memoryunit="KB"
- end if
- if memory > 1024 then
- memory=memory/1024
- memoryunit="MB"
- end if
- 'if memory > 1024 then
- ' memory=memory/1024
- ' memoryunit="GB"
- 'end if
- Set objs = WMI.InstancesOf("Win32_TimeZone")
- for Each obj In objs
- TZ = obj.StandardName
- Next
- Set objs = WMI.InstancesOf("Win32_BIOS")
- for Each obj In objs
- MBSerialNumber = obj.SerialNumber
- BIOSVERSION = obj.SMBIOSBIOSVersion
- Next
- Set objs = WMI.InstancesOf("Win32_NetworkAdapterConfiguration")
- for Each obj In objs
- if obj.MACAddress<>"" then MACADDR = obj.MACAddress
- next
- ComputerName=Computer
- Dim objWMIService,colItems,objItem,objAddress
- Set objWMIService = GetObject("winmgmts:\\" & ComputerName & "\root\cimv2")
- Set colItems = objWMIService.ExecQuery("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True")
- For Each objItem in colItems
- For Each objAddress in objItem.IPAddress
- If objAddress <> "" then
- GetIP = objAddress
- End If
- Next
- Next
- Set objs = WMI.InstancesOf("Win32_DiskDrive")
- for Each obj In objs
- HDDSize = obj.Size
- Next
- if HDDSize > 1024 then
- HDDSize=HDDSize/1024
- HDDSizeunit="KB"
- end if
- if HDDSize > 1024 then
- HDDSize=HDDSize/1024
- HDDSizeunit="MB"
- end if
- if HDDSize > 1024 then
- HDDSize=HDDSize/1024
- HDDSizeunit="GB"
- end if
- Set objs = WMI.InstancesOf("Win32_PnPEntity")
- for Each obj In objs
- if (obj.classguid = "{4D36E96E-E325-11CE-BFC1-08002BE10318}") then Monitor = mid(obj.DeviceID,9,instr(mid(obj.DeviceID,9),"\")-1)
- if (left(obj.DeviceID,7) = "LPTENUM" AND obj.Description<>"Printer Port Logical Interface") then Printer = obj.Name
- Next
- Dim oADSystemInfo
- Dim strUserDN
- Dim objUser
- Set oADSystemInfo = CreateObject("ADSystemInfo")
- strUserDN = Replace(oADSystemInfo.UserName,"/","\/")
- Set objUser = GetObject("LDAP://" & strUserDN)
- strUserDisplayName = objUser.DisplayName '得域账户显示名
- strUserMail= objUser.mail
- strUserAdsPath = objUser.AdsPath
- strUserGroups = objUser.memberOf
- for each usergroup in strUserGroups
- wscript.echo "UserGroups = " & usergroup
- next
- wscript.echo strComputer & vbcrlf & _
- "Model = " & model & vbcrlf & _
- "Serial = " & MBSerialNumber & vbcrlf & _
- "Bios Version = " & BIOSVERSION & vbcrlf & _
- "Memory = " & formatnumber(memory,0) & " " & memoryunit & vbcrlf & _
- "HDD Size = " & formatnumber(HDDSize,0) & " " & HDDSizeunit & vbcrlf & _
- "MAC Address = " & MACADDR & vbcrlf & _
- "Monitor = " & Monitor & vbcrlf & _
- "Printer = " & Printer & vbcrlf & _
- "TimeZone = " & TZ & vbcrlf & _
- "UserName = " & USER & vbcrlf & _
- "ComputerName = " & Computer & vbcrlf & _
- "domainName = " & domain & vbcrlf & _
- "IP = " & GetIP & vbcrlf & _
- "UserDisplayName = " & strUserDisplayName & vbcrlf & _
- "UserMail= " & strUserMail & vbcrlf & _
- "UserAdsPath = " & strUserAdsPath & vbcrlf
复制代码
http://lzy821218.blog.51cto.com/209800/273530
欢迎光临 批处理之家 (http://www.bathome.net/) |
Powered by Discuz! 7.2 |