September 2007

This is not really a Win32 Perl related blog entry, but a problem that my team recently experienced. I am adding this to our blog site with the hope that someone else experiencing the same problem may find it useful and (hopefully) save them some time troubleshooting.

Recently I ran into quite the system administrator emergency. Our Active Directory network started acting flaky. How odd it was that our servers were unable to talk with each other. Client machines were not able to boot onto the network. Attempts to access resources were confronted with ungodly long blocking wait times only to eventually fail.

Applications and services that normally execute flawlessly were suddenly cast into a bottomless pit of error massages such as:

There are currently no logon servers available to service the logon request


The system detected a possible attempt to compromise security. Please ensure that you can contact the server that authenticated you.

Of course the big question was why were there no logon servers available and why was there an attempt to compromise security? Needless to say it took several hours until my team could locate the root cause of the problem. Of course finding the cause is one thing, fixing it and understanding how the problem occurred is another.

Today I was debugging a problem with a script I was writing when I stumbled upon an interesting problem. The script takes data from my clipboard, processes it, formats an HTML report then creates an Outlook email message which it inserts the formatted report and sends it out to a list of recipients.

The script did everything that it should but ran into a problem when it called into the Outlook object model using COM. The standard way to instantiate a COM object is to first attempt to connect with Outlook if it is already running, otherwise run Outlook specifically for the sake of the script:

use Win32::OLE;
my $Class = "Outlook.Application";
my $Outlook = Win32::OLE->GetActiveObject( $Class ) || new Win32::OLE( $Class );
die if ! defined( $Outlook );

This is exactly where my script was failing. The calls into Win32::OLE would pause for several seconds but always return undef. How odd. Calling into Win32::OLE->LastError() to determine the error yielded an equally confusing error message:

0x80080005: "Server execution failed"

Of course there was no easy way to learn why the COM server execution had failed. Needless to say, after tinkering around a bit I discovered that if I first quit Outlook the script executed perfectly. It was only if I was running Outlook that the script failed. How odd.