Script not working.

I’m unable to get anything to download on an endpoint with a script procedure. I’ve tried a quick and dirty urllib.urlretrieve, which silently failed, so I went to the prepared script library and found one called “Download File from the given URL” that appeared like what I needed.
I changed the two variables for download URL and download location, but left everything else the same. It still fails silently. I’ve checked the logs on the server it’s set to download from, and it’s not even requesting the file.
I’ve done a fair amount of programming before, but never in Python until I started working with C1. I’ve only done a handful of scripts up to now, and nothing this complex, so I’m probably missing something simple, unless this script has been broken by an Agent update at some point.

Actually, I think I figured it out. The original script had a path to a user’s desktop folder as the download location, which I changed to “C:” for simplicity while I was testing it.
I did some digging through other scripts in the forum that downloaded files, and realized something. The original script used a single backslash as a separator between directories in the download path, so I did the same thing. The original didn’t have a backslash at the end, though, but since I was using the root of the drive, I had to. Whether it was this, or the fact that the backslash needs to be escaped with another backslash in all of them, I don’t know, but when I set it to “C:” and tested again, it worked.

I did say I was probably missing something simple…

Hello @cbox
When presented with something new, it’s best to start with something simple. Do not assume something is already set as sometimes forgetting the basics will lead us to a facepalm moment. It happened to me, too :slight_smile:

More scripts are available in https://scripts.comodo.com if you can’t find a specific Procedure in the premade ones in the ITSM portal. And, if what you are looking for is still not available in the mentioned link, you can always request for one and our script developers will be ready to assist you.

You’re right, simple is definitely how to start. I’ve done a couple of scripts for things like automating fixes for definition update failures, which is usually because of a corrupt file in \ProgramData\Comodo\SomethingICan’tRemember, so I created one to delete every file in this folder, and I run it on any system that won’t update definitions. It’s worked every time I’ve needed it, so it’s not like I can’t write them. :slight_smile:

However, I now have a new problem. I’ve got this download script working, and I tested it on a couple of my machines. It’s supposed to download a batch file and run it, which in turn plays with some Windows service and scheduled task settings. It worked fine on my machines, and changed the settings as required, and also showed up in the execution log for the procedure.
When I try to run it on a client machine, though, it says it sent the command, but it doesn’t download the batch file, and obviously doesn’t change any settings on the target computer, but it also doesn’t show up in the execution log for the procedure. I’ve tried it again on my own machine, and it doesn’t execute anymore on it, either.
I haven’t changed the script since it worked, either the Python procedure, or the batch file, but it’s not even showing up in the log to say it failed. It’s like it’s not even trying to run.

Is there something going on with the procedure infrastructure that’s not letting them run at the moment?

Chris

You may want to try sending the procedure a couple of times as sometimes a delay with communicating to the cloud servers can cause such a scenario. Also, please do check the online status (gray, blue or green circle) of the endpoints in the ITSM portal.

The client machine is definitely online, and so are mine. I’ve got a VNC session to the remote client machine, and I’m sitting in front of mine. They both show as online in ITSM, too. I ran the procedure on the remote machine a couple of times yesterday, and today it still doesn’t say it’s run, although another test on two local machines just now show successful runs. Still can’t get it to run on the remote machine, though.
So, I tried a different remote machine at the same location, and it worked fine. The only difference I’ve noticed is all the machines that work have a green dot in the Device List, but the one that doesn’t has a blue dot. I know grey is offline, but what’s the difference between blue and green?

There we go! The blue dot there indicates that the enrolled device is online but cannot be remotely accessed as something from the client-side is preventing access to Comodo’s XMPP server.

Since you can establish a VNC session with that device, make sure that the following ‘ItsmRsp.exe’ process and ‘ItsmRsp Service’ service are running. Make sure also that ‘xmpp.cmdm.comodo.com’ is reachable on port 443. Test it with the following command: telnet xmpp.cmdm.comodo.com 443

If the telnet command fails, then something on that device (or in that network) is preventing access to port 443 (HTTPS).

Ok, the ItsmRsp service wasn’t running on the remote machine that doesn’t work, but it also wasn’t running on my local machine that worked and shows a green dot. I’ve started the service on the failing remote machine, but several minutes later, it’s still showing a blue dot.
It’s a Windows 10 machine, so I had to install telnet, but after the install it looks like telnet connects to the server just fine, as there isn’t a connection error (although being that it’s an encrypted server, telnet doesn’t actually show anything; it just goes to a black screen, then several seconds later returns to the prompt.)
After all this, it’s still showing a blue dot in the device list.
I’m going to try rebooting it, although it’s got a feature update to install, so it might be an hour or more before I can get back onto it to test anything else.

Hi @cbox

It’s supposed to download a batch file and run it, which in turn plays with some Windows service and scheduled task settings.

You can run windows batch scripts from ITSM itself. Please refer attached procedure and replace input parameter ‘BAT’ with your original batch script instructions.

Let us know your feedback on this solution as well.

Regardless, a lot of factors might affect download function. We will definitely help you.

@Rick_C Could you escalate this issue to script team with download URL and script details from the customer.

Thanks
Kannan

20171112-Run-batch-script-in-windows.json (1.54 KB)

Well, after a reboot on that failing machine, the blue dot changed to green, and I was able to run the procedure. Worked flawlessly, other than the single typo I made in the batch script.

@makannan, Good to know I can do a batch file from within ITSM if I need to, however, for this one I’m still going to run it as a download and execute.
The batch file is designed to disable MS telemetry, so I’m going to put it on a schedule, so it runs every day for all endpoints. If Microsoft adds some new telemetry functions, I can then just update the batch file on my website, and it will automatically run the new version on the next schedule through ITSM, without modifying and approving procedures.

HI @cbox

Great to hear that script did run success!

Ok fine. I would like to inform you that we can schedule and run python procedures, Powershell scripts, VB scripts and batch scripts via ITSM.

Thanks