- Azure Recovery Services vault: Ironing out the confusion - Fri, Jan 20 2023
- Regex in VSCode - Tue, Jan 17 2023
- Migrate a SQL Server Database to Azure SQL Database - Wed, Jan 11 2023
Windows Task Scheduler is fine for most job scheduling tasks in Windows Server. One weakness, though, is that you can't perform web scraping or simulate keyboard/mouse input. Learn how VisualCron can help you automate otherwise time- and effort-intensive tasks.
Cron has been the default job scheduler in UNIX and UNIX-like operating systems since its inclusion in Version 7 UNIX in 1979. While Cron is powerful, its syntax isn't particularly intuitive. For instance, the following Cron expression defines a job run schedule of 'run once a month at midnight on the first day of the month':
0 0 1 * *
NOTE: This is simply historical trivia, but the UNIX Cron utility does not officially stand for "Command Run On" as most people believe. Ken Thompson, the tool's author, said that the origin of the name Cron is the Greek word for the personification of time, Chronos. The more you know!
In Windows, we systems administrators have historically relied on the Task Scheduler console or the at.exe command-line tool to schedule work. As nice as these tools are, they fall flat for jobs that require web scraping or any interactions that typically require user intervention with mouse and keyboard input.
Although I want to focus on the web automation feature in today's review, you should understand VisualCron's basic use—automating administrative tasks without having to understand programming.
The VisualCron tasks list is huge, but let me give you some representative examples to give you feel for its capabilities:
- Run ad-hoc PowerShell code or invoke entire scripts
- Execute .NET methods from within .DLL assemblies
- Submit commands to IBM AS/400 mainframe minicomputers
- Execute commands on local or remote servers
- Perform file transfers between on-premises and/or cloud storage accounts
- Write log messages, send email, or transmit short message service (SMS) text messages
- Run SQL scripts or SQL Server automation packages
- Encrypt data by using symmetric or asymmetric methods
Go ahead; download the VisualCron free 45-day trial and install it on one of your servers or administrative workstations. One note to consider is that you have to have the .NET Framework 3.5 installed first or the installer bombs out.
You can accomplish this task in Windows Server from an elevated PowerShell prompt:
Install-WindowsFeature -Name Net-Framework-Core
Alternatively, you can use the Deployment Image Servicing and Management (DISM) command-line tool to install .NET 3.5 in Windows 10.
VisualCron is a client/server application, so you should install the client and server on the computers where you plan to run scheduled jobs, and install the client bits on your administrative workstation. See here:
Get-Service -Name *cron* Status Name DisplayName ------ ---- ----------- Running VisualCron VisualCron
At first launch, you'll walk through a wizard to get your VisualCron environment set up. By default, the previously listed VisualCron Server service is configured for auto-start. You'll also see a client shortcut running in the system tray.
To activate the 45-day trial, you have to register a user forum account. You can see the VisualCron Client interface in the following screenshot.
The web macro automation task
VisualCron v8’s standout feature is the web macro automation task. Let's say that you need to download a particular file from a business partner's Internet web site. For whatever reason, there is no application programming interface (API) on their side that would allow you to fetch the file programmatically. You must (a) navigate to the site, (b) browse to the appropriate page, and (c) manually download the file.
We can actually replicate (and automate!) that kind of repetitive task by using VisualCron. Here are some facts about the VisualCron web macro task:
- Web macro playback uses the Google Chrome engine for performance.
- VisualCron stores any passwords you enter on web forms during a recording in an encrypted format.
- You can record browser actions such as switching tabs.
With no further ado, let's automate a web task!
Follow this procedure from within the VisualCron Client to create a new job that includes a web macro task. In my example, I will record the following actions:
- Browse to a particular URL
- Click a hyperlink to download a file
- Take a screenshot
- Store both the downloaded file and screenshot in a new folder named files on my Desktop
- From the Server [localhost] tab, Main settings Ribbon group, open the Jobs menu and select Add job.
- In VisualCron nomenclature, a job is simply a container for one or more tasks. As you can see in the next screenshot, we can define the job execution environment granularly:
- Main settings: Set general runtime properties and define variables
- Triggers: Time- or event-based triggers that kick off the job
- Time exceptions: Date/times that suppress the job from running
- Conditions: Control the flow of jobs and tasks
- Tasks: These are the actual actions carried out in the context of the job
- TimeOut: Set execution window(s) for the job
- Flow: Create pre- and post-execution actions for the job
On my system, I set the job name Website File Download Job and clicked OK to accept all defaults.
- Right-click your new job in the job list and select Add Task to Job 'Website File Download Job' > Net > Web macro from the flyout menus. There is a huge variety of task types in VisualCron, as shown in the following screenshot.
- In the resulting Add Task - Web macro - 1/1 dialog box, navigate to the Web macro tab and click Record. Now the fun begins!
- In the Web recorder interface, type the target URL in the address bar and click Go. As you can see in the following screenshot, I (a) browsed to a specific URL, (b) downloaded a file, and (c) took a screenshot. What's not evident in the screenshot is that I also instructed VisualCron to create a new folder on my Desktop named files.
- Click Stop to end the recording session, and click Yes to save the recorded steps. You can customize the web macro recorder to a stunning degree—look at the following screenshot as evidence:
Test the new job
"The proof is in the puddin'," as my old mentor Bernie Carr used to say. To that end, right-click the new job and select Run Job 'Website File Download Job' > Without Conditions > From first Task from the flyout menus.
On my system, the job completed within 8 seconds or so. The only notifications I received were the two system tray 'toast' messages as shown here:
Honestly, I was a bit skeptical when I began testing VisualCron. It wasn't too long, though, before the sheer power of the tool began inspiring me with new ideas for administrative automation in my environment.
You can check out the pricing details on the VisualCron website; a single-service license costs $399 USD at this writing.
In addition, you should check out VisualCron's cloud automation feature set. Essentially, you can define jobs and automation macros that interact with the major cloud storage services, including Azure cloud storage, Azure S3, Google Drive, OneDrive, Box, and Dropbox.
On a related point, VisualCron also has automation possibilities leveraging the older FTP, FTPS, SFTP, and SCP file-transfer protocols.
I'll leave you with a few more hand-selected VisualCron learning resources in case you're interested.