VB.Net and Installed Operating System Type (OEM or VL)

~OSD~ 2,201 Reputation points
2021-09-24T12:56:34.923+00:00

Hi,

Currently I am checking the Windows 10 license type if it's Volume License (VL) or Pre-Installed (OEM) with slmg.vbs from a command prompt, like this:
135035-image.png

Is it possible to check the same with VB.Net? If its OEM, show form1, if its VL show form2?

Developer technologies | VB
0 comments No comments
{count} votes

Accepted answer
  1. RLWA32 49,551 Reputation points
    2021-09-24T14:28:53.557+00:00

    You can use WMI to get the string (that's what slmgr does). For example,

            Dim LicQuery As SelectQuery = New SelectQuery("SELECT * From SoftwareLicensingProduct")
            Dim Lic As ManagementObjectSearcher = New ManagementObjectSearcher(LicQuery)
            For Each l In Lic.Get()
                Dim s As String = l("Description")
                Console.WriteLine(s)
            Next
    

    I'll leave it to you to parse the returned string. :)

    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Michael Taylor 60,326 Reputation points
    2021-09-24T14:32:54.873+00:00

    Yes you can. You could convert the VBScript file you referenced to VB as it is mostly VB you'd just have to make some adjustments.

    Alternatively look at what the script is doing and just do the same in VB. Most if it is looking at registry entries from what I can see.

    0 comments No comments

  2. ~OSD~ 2,201 Reputation points
    2021-09-27T08:29:46.977+00:00

    Thank you, will check it out.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.