Make a new project, right click on your project from solution explorer and select add reference then a window will come up now select System Management from .NET in the window.
After adding the reference go to the code and add this namespace : imports system.management now you just need to add the code that you can see below in any event, try the form load first.
After adding the reference go to the code and add this namespace : imports system.management now you just need to add the code that you can see below in any event, try the form load first.

