Jump to content

Script to control pulseway agent


Recommended Posts

Posted

Each client has different implementations of a specific 'action', lets say action A.
I have created batch scripts on each client to handle these implementations, so all clients have a C:\Scripts\StartActionA.bat file.
These actions have to run in an existing user session with GUI, so I have set up a powershell script in Pulseway called StartActionA which contains:

cmd.exe /c 'psexec -i 1 -d "C:\Scripts\StartScriptA.bat"'

Through an agent, (phone or my.pulseway.com) I can run this script for a specific PC, and it works beautifully.
It seems as if the windows-agent doesn't support launching scripts, which is in fact a secondary issue.

My goal is now to have disctinct scripts (can be powershell, batch, ...) that sits on a PC (with an agent installed probably) that instructs pulseway to :
run StartActionA on Client A
run StartActionB on Client A
run StartActionA on Client B
run StartActionB on Client B
...

After this is done, I can hook up an elgato streamdeck to launch these last scripts. That's the final goal.

I've been struggling with the scripts that interface with Pulseway to instruct Pulseway to launch ScriptA on ClientA.
Is this at all possible?

Kind regards,
Arne

Posted (edited)

Hey,

I have set up the pulseway-scripts that allow me to run a program remotely in an existing user session, they work.
If I click 'Client01 > Scripts > 'StartApplications' > 'StartApplicationA'; Pulseway runs a powershell script on Client01 that starts ApplicationA on the usersession that is logged in; so with GUI. This works great!

In practice:
Let's say I run a classroom with 10 stations. People using the stations can't launch programs themselves. They should request a program to the teacher, and the teacher launches the programs 'remotely': from a computer in the front of the class. The teacher can go to the my.pulseway webapp, select the client that requested an app (lets say firefox.exe), scroll to scripts, select the correct scripts-folder, and run the 'StartFirefox'-script. So this works.

Now make the teacher's job a little more convenient, I was thinking about an elgato streamdeck. You can configure the buttons to do perform actions. They support integration into OBS etc, but even cooler, they support running scripts. It also has the function of 'nesting' actions: so top-level buttons would be 'folders' where each folder is one of the ten PC's. The level below that would be where scripts live to run actions on the selected PC, for example the 'StartFirefox'-script.

What I'm looking for is a script that runs on a (preferrably windows 10) PC where an agent is installed. The script would instruct pulseway to run the 'StartFirefox'-script from pulseway on Client01. This so that a push on the streamdeck-buttons directs pulseway to run a script on a specific client. Something like

cmd.exe /c 'pulseway -client Client01 -runscript StartFirefox'

where the pulseway-command interacts with the pulseway-agent on the local system and instructs it to do specific stuff.

In other words, I want to script this part of the guide

Quote

You can run automation scripts on-demand on a single system at a time. Open the WebApp or mobile apps, select the system you wish to run the script and then click on the Scripts feature. Select the script category, click on the script you want to run and then run the script. Once the script has finished executing, click on the execution from the last executions and you will see the script output.

Where 'Select the system', 'Select the script category', 'click on the script you want to run' and 'run the script' can be done with a script (.cmd, .bat, .ps1, ...)

 

Edited by Arne
Accidental ctrl+enter
  • Staff
Posted

Hi @Arne,

In Pulseway WebApp it is possible to create scopes and then run scripts as an automated task using these scopes, therefore if you create an automated task to execute script on certain scope of systems, then it will be done.

image.png.3d4fb3b251ec142e272e47532a81d722.png

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...