There are planty of similar questions on StackOverflow and the programming language is not very relevant here. But none of them is canonical or comprehensive enough. I found this post on reddit, it lists many options and should give you an idea of how complex this task is. I would expect that something in Windows (e.g. WMI?) does all job, but no guarantee.
↧