Langa Letter: Solving Automatic Maintenance Problems - InformationWeek
Software // Enterprise Applications
07:59 PM
Fred Langa
Fred Langa
Ransomware: Latest Developments & How to Defend Against Them
Nov 01, 2017
Ransomware is one of the fastest growing types of malware, and new breeds that escalate quickly ar ...Read More>>

Langa Letter: Solving Automatic Maintenance Problems

Fred Langa explains how to address problems with Windows XP automation, looking at XP's self-maintenance tools and techniques.

In "Make Windows XP Self-Maintaining", we discussed how to automate Windows XP tools and tasks that normally require manual intervention. This involves three steps: (1) finding the right text command(s) and modifiers to launch the maintenance tool or process that you want, in the way you want; (2) building a simple script or batch file to issue the command; and (3) using Task Scheduler to execute the script or batch file at the desired times. (This is, of course, a highly compressed explanation. Please see the original article for the full detail.)

But there are cases where this automation method won't work as intended or may prove unwieldy. For example, XP's Backup applet is one of the most configurable--and thus most complex--of that operating system's built-in maintenance tools. A command to launch the Backup applet with all the normal options can involve well over 300 characters' worth of obscure shorthand data, each element of which must be in precisely the correct position, format, and sequence. It's way too much data to try to figure out and enter accurately by hand.

There can be other automation troubles, too, including very common problems with permissions and passwords for scheduled maintenance events.

And sometimes, XP gets in its own way. For example, the XP Backup applet comes with a "Wizard" to simplify its use, but on its own, the Wizard produces a standalone task that may not integrate well with other maintenance tasks. If Backup is the only task you want to run, then there's no problem, but if you want to perform a more-complicated series of maintenance tasks, you may run into serious trouble:

Let's say you want to have your PC automatically wake itself up every day at 3 a.m., clean up your hard drive, back up all your files, defrag every disk or partition in your system, and then go back to sleep. If you use only XP's built-in Backup Wizard, you'll have no simple way of ensuring that your backups will run the way you want--after the cleanup but before the defrag. You're basically forced to guess when to launch Wizard-generated maintenance tasks, hoping you've allowed enough time in between. Of course, if you guess wrong, two or more tasks may end up competing for the hard drive at the same time. In some cases, tasks that compete this way may never run to completion. This, in fact, is the major limitation of the Backup Wizard and similar crude schedulers: Your tasks exist largely in isolation, rather than being smoothly integrated into your overall maintenance procedures.

"Make Windows XP Self-Maintaining" showed how a script or batch file can correctly sequence a whole series of maintenance tasks, helping to ensure that one task finishes before another begins. But handcrafted scripts and batch files can have their own limitations, too, especially when you're talking about automating a tool like Backup that may require an enormously complex command line hundreds of characters long.

The solution is a hybrid approach: Use a tool like the Backup Wizard to generate the complex command line you want, then lift that command line and use it in your own simple scripts or batch files. That way, you get all the power and ease of the Wizard approach but all the flexibility and proper sequencing of the script or batch file approach.

This works not only for XP's Backup applet but also for many other complex tools and utilities that have a Wizard or similar front end that integrates with Task Scheduler. You can lift the automatically generated command line out of Task Scheduler to use as you see fit in your own custom scripts and batch files. It's easy and opens up incredible power to you.

This may sound confusing, but seeing a specific example (we'll use Backup as our case in point), will make everything clearer.

1 of 4
Comment  | 
Print  | 
More Insights
Newest First  |  Oldest First  |  Threaded View
[Interop ITX 2017] State Of DevOps Report
[Interop ITX 2017] State Of DevOps Report
The DevOps movement brings application development and infrastructure operations together to increase efficiency and deploy applications more quickly. But embracing DevOps means making significant cultural, organizational, and technological changes. This research report will examine how and why IT organizations are adopting DevOps methodologies, the effects on their staff and processes, and the tools they are utilizing for the best results.
Register for InformationWeek Newsletters
White Papers
Current Issue
2017 State of IT Report
In today's technology-driven world, "innovation" has become a basic expectation. IT leaders are tasked with making technical magic, improving customer experience, and boosting the bottom line -- yet often without any increase to the IT budget. How are organizations striking the balance between new initiatives and cost control? Download our report to learn about the biggest challenges and how savvy IT executives are overcoming them.
Twitter Feed
Sponsored Live Streaming Video
Everything You've Been Told About Mobility Is Wrong
Attend this video symposium with Sean Wisdom, Global Director of Mobility Solutions, and learn about how you can harness powerful new products to mobilize your business potential.
Flash Poll