is this code right for Windows PC to get serial number ?
it’s returning nothing at this time
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
Dim sh As New Shell
sh.Execute("powershell -command ""(Get-WmiObject -Class Win32_OperatingSystem).SerialNumber""")
Dim serialNumber As String = sh.Result.Trim
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.