Documentation ¶
Overview ¶
Package wmi provides a WQL interface for WMI on Windows.
Example code to print names of running processes:
type Win32_Process struct { Name string } func main() { var dst []Win32_Process q := wmi.CreateQuery(&dst, "") err := wmi.Query(q, &dst) if err != nil { log.Fatal(err) } for i, v := range dst { println(i, v.Name) } }
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
ErrInvalidEntityType = errors.New("wmi: invalid entity type")
)
Functions ¶
func CreateQuery ¶
CreateQuery returns a WQL query string that queries all columns of src. where is an optional string that is appended to the query, to be used with WHERE clauses. In such a case, the "WHERE" string should appear at the beginning.
func Query ¶
Query runs the WQL query and appends the values to dst.
dst must have type *[]S or *[]*S, for some struct type S. Fields selected in the query must have the same name in dst. Supported types are all signed and unsigned integers, time.Time, string, bool, or a pointer to one of those. Array types are not supported.
By default, the local machine and default namespace are used. These can be changed using connectServerArgs. See http://msdn.microsoft.com/en-us/library/aa393720.aspx for details.
func QueryNamespace ¶
QueryNamespace invokes Query with the given namespace on the local machine.
Types ¶
type ErrFieldMismatch ¶
ErrFieldMismatch is returned when a field is to be loaded into a different type than the one it was stored from, or when a field is missing or unexported in the destination struct. StructType is the type of the struct pointed to by the destination argument.
func (*ErrFieldMismatch) Error ¶
func (e *ErrFieldMismatch) Error() string