shirou / gopsutil

psutil for golang
Other
10.47k stars 1.58k forks source link

Using host.HostID() on the Windows platform The uuid obtained is different from the cmd `wmic csproduct get uuid` #1555

Open kakj-go opened 9 months ago

kakj-go commented 9 months ago

Is your feature request related to a problem? Please describe. Using host.HostID() on the Windows platform The uuid obtained is different from the cmd wmic csproduct get uuid

Describe the solution you'd like add method host.MachineCode(), this method use cmd wmic csproduct get uuid to get uuid

Additional context

image

host.HostID() return b418a861-8693-4e57-904a-448e0451ab7b

futurecad commented 4 months ago

How did you solve it in the end?

futurecad commented 4 months ago

I think the two methods of obtaining are different. If you use the cmd method, there will be some vmic that does not exist.