Programmatically Determine the Operating System using .NET

/ Published in: VB.NET
Save to your folder(s)

Copy this code and paste it in your HTML
  1. Imports System
  2. Imports System.Management
  4. Namespace ConsoleApplication1
  5. Friend Class Program
  6. Public Shared Sub Main()
  7. Dim winos As String = "Select Name from Win32_OperatingSystem"
  8. Dim mos As New ManagementObjectSearcher(winos)
  9. For Each mo As ManagementObject In mos.Get()
  10. Console.WriteLine("OS Name: {0}", mo("Name"))
  11. Next mo
  12. Console.ReadLine()
  13. End Sub
  14. End Class
  15. End Namespace


Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.