Add Script to System Tray

I would like the ability to add scripts to the system tray menu for the customer to be able to trigger.

For example, when the customer has a printing problem, they can run my clean print spooler script that stops the spooler, deletes all the spooler files, then starts the spooler.

Right now the customer has to submit a ticket, wait for my response, then I manually trigger the script.

2 Likes

You can make the scripts available for users to run in the portal. I don’t think you can do it from the tray, but if that is what you need portal works.

You can run single line CMD in the menus. I have this setup as an “Execute a CMD” to clear the print queue

powershell "Stop-Service spooler -Force; $files = Get-ChildItem -Path $env:SystemRoot\System32\spool\PRINTERS -Force; $files | Remove-Item -Force; Start-Service spooler;[System.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms');[System.Windows.Forms.Messagebox]::Show('Print queue cleared!')"
2 Likes

still pretty new here, how do I add scripts available in the portal?

When editing the script, there’s a checkbox, but look at my reply above for a solution to your suggestion. It invokes PS to clear the print queue.

In the policy section: see pic

I got how to add commands to the tray icon. but what about adding scripts to the user portals

Edit the script, check “Available on Every Customer Portal”.

+1 for adding scripts as a sub-menu item in the system tray.

1 Like

Hi Jimmie, i tried your cmd command, it works when i use it directly on the machine in CMD but it does not work when using it from the system tray, nothing happens, not even the message shows up. Any idea why?

EDIT: i just found your comment on this thread: System Tray Icon One-Liners
Then i used your command from there, and bizzarely it worked right away. Maybe there’s an issue with the pasted text in this thread? No idea, but thanks for sharing!!!

Looked the same when I repasted it over, but I just put it in the block, so maybe that’ll help.