Query the Asset Information of Zebra Scanners via Windows Management Instrumentation (WMI) Using a VBScript
Windows Management Instrumentation (WMI) is an industry standard from Microsoft for the management of hardware devices, including Zebra barcode scanners, in a Windows enterprise computing environment. You can write WMI scripts or applications to automate administrative tasks remotely on networked computers. This article will walk you through discovering Zebra Scanners & subsequently querying asset information, such as model number, serial number, firmware version, etc... via WMI using VBScript
Guide
1. Open your favorite text editor, Visual Studio Code, Notepad++, etc.
Microsoft Visual Studio Code is recommended as it is rich with VBScript supporting extensions. The latest version can be downloaded via the link https://code.visualstudio.com/
2. Define the host, localhost, or the remote PC.
A string can define multiple host IPs, including the localhost.
' Remote IP, or the localhost. Define all the IPs in the following Array.
arrComputers = Array("127.0.0.1")
3. Retrieve an instance of the class.
The GetObject method is called by WMI to retrieve an instance of a class.
Query object that indicates the set of properties to be populated, as requested by a call to GetObject.
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
4. Executes a WQL query to retrieve objects.
The ExecQuery method is called by WMI to process a WMI Query Language (WQL) query.
Pointer to the context object for this call. This value contains any IWbemContext properties specified by the client.
Also, this pointer must be used as a parameter to any calls back into WMI.
Set colScanners = objWMIService.ExecQuery("SELECT * FROM Symbol_BarcodeScanner", "WQL", _ wbemFlagReturnImmediately + wbemFlagForwardOnly)
5. Query-supported properties from the Zebra WMI Driver Provider.
For Each objScanner in colScanners
WScript.Echo “Model Number: “ & objScanner.PartNumber
WScript.Echo “Serial Number: “ & objScanner.SerialNumber
WScript.Echo “Firmware Version: “ & objScanner.FirmwareVersion
Next
All the supported properties by the Zebra WMI Providers are listed on the Developer Guide.
The latest version of the document was published on the Barcode Scanner SDK for Windows Support page.
https://www.zebra.com/us/en/support-downloads/software/developer-tools/scanner-sdk-for-windows.html
Priyanka Shrimali
0 Replies