Archives are back online and comment spam tastes bad

Shitter's fullHoly crappers. All of the archives from the previous incarnation of have been brought into the current site, except for all the junk I posted between 2002 and 2006 (because it was hard enough bringing the current posts up to speed, heh). So now I can focus on all new bland content!

Incidentally, does anyone else running WordPress get this much comment spam? Fortunately none of the comments make it to the live/public site, but good gravy are there a lot of them. I’ve gotten into the habit of just periodically shit-canning these spam comments to my site’s internal spam folder, but if you know of an accurate, more automated solution for dealing with comment spam on WordPress, please let me know!

Oh and here’s a shameless plug: How are you feeling? How is the world feeling? Find out now on MoodClimate!

Here we go again…

Here we go againSo I guess this is my fourth iteration of in the past decade, heh. I’ve had more than a few long winded thoughts backed up in my brain that I knew the Internet would love to hear so I decided to revamp the site again. That, and I moved it to a new hosting company. Oh and I’ve learned to stop worrying and love WordPress in the past few years.

So anyway, I’m in the long, slow, and painful process of migrating all of my old posts from the previous incarnation of the site to the current incarnation. Why? Who knows. But anyway, stay tuned, because all of your favorite classics will soon be back, and I have a couple of topics I’ve been dying to complain… errr…. write about: The Plague of Software/Application Updates and my thoughts on the Chicago Startup Scene. Check back again soon!

Fun with scheduled tasks in Windows

Fun with scheduled tasksAs many people know, Microsoft Windows has a built-in task scheduler (like *nix cron) to run programs at particular times. Recently at work, I’ve had to start using the Microsoft Windows Server 2008/Vista Task Scheduler (2.0) which is fairly different from the Windows Server 2003/Windows XP (1.0) Task Scheduler (2.0). Read on…

For those who haven’t used the Task Scheduler 2.0, it’s actually pretty handy, especially compared to the original Task Scheduler. Here are some benefits:

The Good

Instead of just being able to run the task at a specific time, you now have the ability to trigger a task to start with several events called triggers:

  • On a schedule
  • At log on
  • At startup
  • On idle
  • On an event
  • At task creation/modification
  • On connection to user session
  • On disconnect from user session
  • On workstation lock
  • On workstation unlock

The first option, “On a schedule”, gives you the classic task scheduler… scheduling. And on top of that, you can define multiple triggers on a given task. So if you need a task to run at multiple times a day, you no longer need to define multiple jobs in the task scheduler, just define one job with multiple triggers.

Similar to the enhancements regarding triggers, you have the ability to define actions for a task now, instead of just a program to run. Actions include:

  • Start a program
  • Send an e-mail
  • Display a message

The first option, “Start a program”, gives you the classic task scheduler option of specifying the program to start when the scheduler fires for that task. And much like triggers, you can define multiple actions for a given task.

You can now export your job definitions from the Task Scheduler as plain ol’ XML. This is useful for doing things like putting your job definitions in version control (I still need to put together a tool to do that for me automatically :-)). And you can then import those XML definitions back into the Task Scheduler.

So if you need to create multiple jobs that are very similar to each (just have some different command args, names, etc.), I’ve found it easy to create one task as a sort of template, export it to XML, copy the XML for each other job I need, modify each XML for whatever little tweak it needs, rename the file (the Task Scheduler uses the XML file name as the imported Task name), then import the file back in. Personally I’m faster at doing that than clicking through all the Create Task screens.

You can define a folder hierarchy to organize tasks, much like on your hard drive you create a directory hierarchy to organize files. This is really useful on machines that have dozens of various tasks defined.

The Bad

Renaming Objects… or not
Maybe this is just a permission problem on my specific machine, but I have yet to find a way to rename folders in the Task Scheduler, or Tasks themselves! Right now my workaround is to export the Task to XML, rename the file, then import it back in. Similarly, I just remove folders and recreate them with the new name. Pretty tedious stuff, especially when it needs to be done for lots of tasks.

The Ugly

No Migration Utilities
Maybe I didn’t look hard enough, but I spent some time Googling around for a way to convert the Windows Server 2003/XP .job scheduled task files into the Windows Server 2008/Vista XML scheduled task files. After I stumbled across this, I gave up: itprovistamigration/thread/76b6276b-49f2-41e2-b4ea- f537e0eb88a8. From a Microsoft moderator in this thread:

We cannot import .job files to Task Scheduler into Windows Vista . In addition, we have no way to convert .job files to .xml files. Therefore, we cannot run schedule tasks created on previous systems on Windows Vista/Server 2008.

Why does this not surprise me. (don’t answer that)

Well, at work I had the task to move about 100+ scheduled tasks from one machine to another. Unfortunately, the source machine was Windows Server 2003, and the target machine was Windows Server 2008, and I was not about to recreate 100+ scheduled tasks by hand. Forutnately, I was able to script the process. While I can’t give away the code verbatim, I’ll give you a rough idea as to what I did:

First, I used the Windows Server 2003/XP schtasks (with the /query /fo csv /v args) to get a nice little CSV file of all the scheduled tasks on the source machine.

Then, I exported a dummy scheduled task from a Windows Server 2008 box and created a sort of template job definition file. I put in place holders for things like the user to run the job as, the command line, the schedule, etc.

Then, I whipped up a little Perl script, using Text::CSV_XS for CSV parsing, to read in the CSV, massage the data a little, and used my template XML job definition to create the 100+ job XML files. The whole process runs in less than a minute, not too shabby.

Now, today I just need to find a way to automatically import these jobs. So if you too are looking for a way to convert Windows Server 2003/XP .job files into Windows Server 2008/Vista XML task definition files, hopefully this helps. I haven’t really looked into a C# API for the Task Scheduler 2.0, but this looks promising. Happy task scheduling!