simple command execution script

Hi there
With my less than 0 knowledge in Python i am trying to make a screengrab script - you start it on slave / task and you have screenshot opened.
So beacause my knowledge of Python is very limited i’ve gone a way of script-kiddie :smiley:
I’ve made a simple script in AutoIt - when it runs - it makes a screengrab and places a jpg file in a specified path.
Now i am struggling with making a script in Python to start this small utility remotely and after that “execute” shell command with that image - so you will have it opened in your default picture viewer.
I’ve took as a start point start/stop service script , as it has actually all i need - runs on a slave and runs a command line.
So i encountered 2 problems.
First - where i can see logs of python errors ? Script just does not start and i cannot see why
Second - i think that my problem is “SlaveUtils.SendRemoteCommand” , for some reason it just does not work.
This is the line i am trying :

machineNames = SlaveUtils.GetMachineNameOrIPAddresses(selectedSlaveInfoSettings) for machineName in machineNames: SlaveUtils.SendRemoteCommand( machineName, "Execute \\\\piknas003\\Resources\\TEMP\\ScreenshotsDeadline\\grabscreen.exe" )

Thanks a lot !

To see the errors just open console window in deadline monitor.

Awesome , thanks a lot !
I forgot that in Python you need 4 spaces to define structure of code. Finished the script , works like a charm !

And now another problem. Screenshot returns black , because no user logged in… So i have a question - if i will implement screenshot function in Python script - without AutoIt - will it grab screen ?

I’m not sure what you are trying to take a screenshot of, but as there is no user logged in, and thus no desktop, I don’t think you’ll see anything in a screenshot.

If it’s running as a service, you’ll need to check off the ‘interact with desktop’ option in the service configuration for that to work for you. Windows won’t create a graphics context for the service without that.

Well this is not related to Deadline actually , because script is done and it is working now.
Since we are working mostly on static images and we have 2 active servers which are acting as distributed rendering servers - our guys are connecting to these 2 servers to check the process. So since we have 2 PC’s and a team of about 15 people - sometimes happens that they just throw eachother out of RDP connection.
To avoid that i wanted to make a script which will take screenshot. Right click - screenshot - it is opened. Without connecting to RDP.
Now i am searching a way to keep user connected/logged it even after RDP connection closed , or keep it on always.
That’s a good hint about trying to run as a service actually.
Will try that , thanks eamsler !

Any time sir. I wrote my own version of what you’re working on back at the old company. Hopefully you can get that working as a service. I was lucky: our nodes were logged into full user accounts.