Skip to content

Instantly share code, notes, and snippets.

@stefanschneider
Created July 16, 2014 11:52
Show Gist options
  • Save stefanschneider/61fdd197e6f6c719296a to your computer and use it in GitHub Desktop.
Save stefanschneider/61fdd197e6f6c719296a to your computer and use it in GitHub Desktop.
package main
import (
"github.com/StackExchange/wmi"
"log"
)
type Win32_Process struct {
ProcessId uint32
Name string
VirtualSize uint64
CommandLine *string
}
func main() {
var dst []Win32_Process = make([]Win32_Process, 0, 0)
q := wmi.CreateQuery(&dst, "")
for {
err := wmi.Query(q, &dst)
if err != nil {
//log.Fatal(err)
log.Println(err)
}
}
for i, v := range dst {
println(i, v.ProcessId, v.Name, v.VirtualSize, *v.CommandLine)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment