Open mustofa-id opened 2 months ago
I found a more elegant way to get a list of printers on Windows using the following command:
Get-WmiObject -Class Win32_Printer | ConvertTo-Json
This command produces a direct output in JSON format.
You can even filter the properties you need:
Get-WmiObject -Class Win32_Printer | Select-Object Name, DeviceID, DriverName, Location | ConvertTo-Json -Compress
I ran into an error while calling the
getPrinters()
function. The error message isSyntaxError: Expected ',' or ']' after array element in JSON at position 1151
.Stack trace:
Here is the list of printers on my computer:
PS C:\Users\Me> wmic printer list /format:list
Thanks for putting together this project. it’s incredibly smart and helpful.