vbs 获取硬件序列号等信息 、 BIOS信息、Machine Name

获取硬件序列号等信息 、 BIOS信息

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")


Set colBIOS = objWMIService.ExecQuery("Select * from Win32_BIOS")

For each objBIOS in colBIOS
  WScript.Echo "SERIAL=" & objBIOS.SerialNumber & vbCrlf & _
        "Manufacturer=" & objBIOS.Manufacturer &vbCrlf & _
        "Name=" & objBIOS.Name &vbCrlf & _
        "Status=" & objBIOS.Status &vbCrlf & _
        "Version=" & objBIOS.Version &vbCrlf & _
        "Caption=" & objBIOS.Caption &vbCrlf & _
        "Description=" & objBIOS.Description &vbCrlf & _
        "CodeSet=" & objBIOS.CodeSet &vbCrlf & _
        "BuildNumber=" & objBIOS.BuildNumber &vbCrlf & _
        "CurrentLanguage=" & objBIOS.CurrentLanguage &vbCrlf & _
        "TargetOperatingSystem=" & objBIOS.TargetOperatingSystem &vbCrlf & _
        "OtherTargetOS=" & objBIOS.OtherTargetOS &vbCrlf & _
        "SoftwareElementID=" & objBIOS.SoftwareElementID &vbCrlf & _
        "SoftwareElementState=" & objBIOS.SoftwareElementState &vbCrlf & _
        "InstallDate=" & objBIOS.InstallDate &vbCrlf
Next

获取 机器名称 Machine Name

1
2
3
Set wshShell = WScript.CreateObject( "WScript.Shell" )
strComputerName = wshShell.ExpandEnvironmentStrings( "%COMPUTERNAME%" )
WScript.Echo "Computer Name: " & strComputerName