Skip to main content

Posts

Showing posts with the label continuous integration

Windows .BAT Script to launch task, then loop until done

My last post described my discovery of the Windows Schtasks.exe utility to trigger via the command-line a scheduled task on a local or - more relevant to the challenges I was facing - on a remote server. I described its ability to query the state of the task, and to launch it. Of course, since my whole purpose was to automate a tedious manual section of our build process, Schtasks.exe is helpful but hardly the end of the story. To benefit from that new knowledge, I now need to create a Windows shell script that our Continuous-Integration tool Jenkins can launch. This post is almost a stream-of-consciousness blog as I play with this problem. The requirements are that the script launch the remote scheduled task, poll its status until it is complete, and end with an appropriate result code. Some minimal logging of activity would also be nice. To begin, I created a .BAT file and created a labelled section to trigger the remote task: :LaunchBuild REM  QUESTION: What if it is...

Trigger Windows Scheduled Task from Remote Computer via Jenkins

One thing I love about working in Information Technology is the opportunity - the NEED - to constantly learn new things. If a week goes by in which I have not looked up something on StackOverflow or other message boards, I start lobbying my team for more challenges. This week, I learned the power of running " SCHTASKS.exe " from a command-line script for a remote server in a Microsoft Windows environment. If you don't know Schtasks, you can read up on it here: https://msdn.microsoft.com/en-us/library/windows/desktop/bb736357(v=vs.85).aspx In a nutshell, it is the command-line interface for the Windows Task Scheduler, and allows you (or a system administrator) to create, change, run, query, terminate, and delete scheduled tasks on a work-station, either the local one or a remote one. Not all of the features are available in older versions. In my scenario below, this was relevant as the local computer will be a Windows 8 machine, and the remote server is, shall we ...