forked from jaypipes/ghw
-
Notifications
You must be signed in to change notification settings - Fork 0
/
baseboard_windows.go
33 lines (27 loc) · 933 Bytes
/
baseboard_windows.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Use and distribution licensed under the Apache license version 2.
//
// See the COPYING file in the root project directory for full text.
//
package ghw
import "github.com/StackExchange/wmi"
const wqlBaseboard = "SELECT Manufacturer, SerialNumber, Tag, Version FROM Win32_BaseBoard"
type win32Baseboard struct {
Manufacturer string
SerialNumber string
Tag string
Version string
}
func (ctx *context) baseboardFillInfo(info *BaseboardInfo) error {
// Getting data from WMI
var win32BaseboardDescriptions []win32Baseboard
if err := wmi.Query(wqlBaseboard, &win32BaseboardDescriptions); err != nil {
return err
}
if len(win32BaseboardDescriptions) > 0 {
info.AssetTag = win32BaseboardDescriptions[0].Tag
info.SerialNumber = win32BaseboardDescriptions[0].SerialNumber
info.Vendor = win32BaseboardDescriptions[0].Manufacturer
info.Version = win32BaseboardDescriptions[0].Version
}
return nil
}