# SerialNumber Windows 11

**URL:** <https://forum.xojo.com/t/serialnumber-windows-11/83020>\
**Category:** Windows\
**Created:** [October 30, 2024, 10:35pm UTC](https://forum.xojo.com/t/serialnumber-windows-11/83020 "2024-10-30T22:35:17Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Patrice\_C](https://forum.xojo.com/user_avatar/forum.xojo.com/patrice_c/32/14346_2.png) [@Patrice\_C](https://forum.xojo.com/u/Patrice_C)\
**Post date:** [October 30, 2024, 10:35pm UTC](https://forum.xojo.com/t/serialnumber-windows-11/83020/1 "2024-10-30T22:35:17Z")

</div>

is this code right for Windows PC to get serial number ?  
it’s returning nothing at this time

```auto
Dim wmi As New WindowsWMIMBS
// Execute the WMI query for BIOS serial number
If wmi.ConnectServer("root\cimv2") Then
  If wmi.Query("WQL", "SELECT SerialNumber FROM Win32_BIOS") Then
    // Get the serial number if available
    If wmi.NextItem Then
      SerialPC = wmi.GetPropertyString("SerialNumber").Trim
    End If
  End If
End If

```

---

<div class="post-metadata">

**Author:** ![Rick\_Araujo](https://forum.xojo.com/user_avatar/forum.xojo.com/rick_araujo/32/251_2.png) [@Rick\_Araujo](https://forum.xojo.com/u/Rick_Araujo)\
**Post date:** [October 30, 2024, 11:04pm UTC](https://forum.xojo.com/t/serialnumber-windows-11/83020/2 "2024-10-30T23:04:36Z")

</div>

Do you get something from this powershell cmd? :

```auto
(Get-WmiObject -class Win32_BIOS).SerialNumber

```

Here I get the Bios Serial of my computer as expected (not the OS Serial)

For the OS I can get the serial ID from this class:

```auto
(Get-WmiObject -Class Win32_OperatingSystem).SerialNumber

```

---

<div class="post-metadata">

**Author:** ![Patrice\_C](https://forum.xojo.com/user_avatar/forum.xojo.com/patrice_c/32/14346_2.png) [@Patrice\_C](https://forum.xojo.com/u/Patrice_C)\
**Post date:** [October 31, 2024, 5:18pm UTC](https://forum.xojo.com/t/serialnumber-windows-11/83020/3 "2024-10-31T17:18:56Z")

</div>

With this code I guet Shell Timed out

```auto
Dim sh As New Shell
sh.Execute("powershell -command ""(Get-WmiObject -Class Win32_OperatingSystem).SerialNumber""")

Dim serialNumber As String = sh.Result.Trim

```

---

<div class="post-metadata">

**Author:** ![Rick\_Araujo](https://forum.xojo.com/user_avatar/forum.xojo.com/rick_araujo/32/251_2.png) [@Rick\_Araujo](https://forum.xojo.com/u/Rick_Araujo)\
**Post date:** [October 31, 2024, 8:47pm UTC](https://forum.xojo.com/t/serialnumber-windows-11/83020/4 "2024-10-31T20:47:35Z")

</div>

I didn’t ask you to launch it via Xojo, it was just for you inspect if you got your intended values.

Then use your MBS plugin and read the value as your MBS docs probably explains.

---

<div class="post-metadata">

**Author:** ![Patrice\_C](https://forum.xojo.com/user_avatar/forum.xojo.com/patrice_c/32/14346_2.png) [@Patrice\_C](https://forum.xojo.com/u/Patrice_C)\
**Post date:** [October 31, 2024, 9:03pm UTC](https://forum.xojo.com/t/serialnumber-windows-11/83020/5 "2024-10-31T21:03:45Z")

</div>

Working on it but yeah I forgot to say that the powershell returned correct values.

---

<div class="post-metadata">

**Author:** ![Bill\_Sanders](https://forum.xojo.com/letter_avatar_proxy/v4/letter/b/77aa72/32.png) [@Bill\_Sanders](https://forum.xojo.com/u/Bill_Sanders)\
**Post date:** [November 1, 2024, 1:39am UTC](https://forum.xojo.com/t/serialnumber-windows-11/83020/6 "2024-11-01T01:39:56Z")

</div>

WMIC is off by default in Win 11. Maybe that is the issue?

> **[WMI command line (WMIC) utility deprecation: Next steps](https://techcommunity.microsoft.com/t5/windows-it-pro-blog/wmi-command-line-wmic-utility-deprecation-next-steps/ba-p/4039242)**
>
> Get ready for the next step in WMIC deprecation: this feature on demand will be disabled by default soon.

---

<div class="post-metadata">

**Author:** ![Rick\_Araujo](https://forum.xojo.com/user_avatar/forum.xojo.com/rick_araujo/32/251_2.png) [@Rick\_Araujo](https://forum.xojo.com/u/Rick_Araujo)\
**Post date:** [November 1, 2024, 8:01am UTC](https://forum.xojo.com/t/serialnumber-windows-11/83020/7 "2024-11-01T08:01:27Z")

</div>

Nope. He’s using a plugin to access the instrumentation. WMIC wasn’t used in the entire thread. He accessed the value via powershell, so his problem is isolated to his use of the plugin.
