add printers to console

Signed-off-by: si458 <simonsmith5521@gmail.com>

si458 committed May 16, 2026 at 09:58 UTC 73ce7cf3e2702468d9bf2aaf2e5aed5fa27fca8f
1 file changed +11 -3
agents/meshcore.js
+11 -3
@@ -4237,12 +4237,12 @@ function processConsoleCommand(cmd, args, rights, sessionid) {
4237 case 'help': { // Displays available commands
4238 var fin = '', f = '', availcommands = 'domain,translations,agentupdate,errorlog,msh,timerinfo,coreinfo,coreinfoupdate,coredump,service,fdsnapshot,fdcount,startupoptions,';
4239 availcommands += 'alert,agentsize,versions,help,info,osinfo,args,print,type,dbkeys,dbget,dbset,dbcompact,eval,parseuri,httpget,wslist,plugin,wsconnect,wssend,wsclose,notify,';
4240 - availcommands += 'ls,ps,kill,netinfo,location,power,wakeonlan,setdebug,smbios,rawsmbios,toast,lock,users,openurl,getscript,getclip,setclip,log,cpuinfo,sysinfo';
4240 + availcommands += 'ls,ps,kill,netinfo,location,power,wakeonlan,setdebug,smbios,rawsmbios,toast,lock,users,openurl,getscript,getclip,setclip,log,cpuinfo,sysinfo,';
4241 availcommands += 'apf,scanwifi,wallpaper,agentmsg,task,uninstallagent,display,openfile';
4242 if (require('os').dns != null) { availcommands += ',dnsinfo'; }
4243 try { require('linux-dhcp'); availcommands += ',dhcp'; } catch (ex) { }
4244 if (process.platform == 'win32') {
4245 - availcommands += ',bitlocker,cs,wpfhwacceleration,uac,volumes,rdpport,domaininfo';
4245 + availcommands += ',bitlocker,cs,wpfhwacceleration,uac,volumes,rdpport,domaininfo,printers';
4246 if (bcdOK()) { availcommands += ',safemode'; }
4247 if (require('notifybar-desktop').DefaultPinned != null) { availcommands += ',privacybar'; }
4248 try { require('win-utils'); availcommands += ',taskbar'; } catch (ex) { }
@@ -4324,7 +4324,15 @@ function processConsoleCommand(cmd, args, rights, sessionid) {
4324 {
4325 response = 'Proper usage: taskbar HIDE|SHOW [TSID]';
4326 break;
4327 - }
4327 + case 'printers':
4328 + if (process.platform != 'win32') {
4329 + response = 'Unknown command "printers", type "help" for list of available commands.';
4330 + } else {
4331 + var printers = require('win-wmi-fixed').query('ROOT\\CIMV2', 'SELECT * FROM Win32_Printer');
4332 + trimResults(printers);
4333 + for (var i = 0; i < printers.length; ++i) {
4334 + sendConsoleText(printers[i].Name + ' - ' + printers[i].PortName, sessionid);
4335 + }
4336 }
4337 break;
4338 case 'privacybar':