Archive for the 'Windows' Category

Windows Wireless Zero Configuration Sucks

God I hate WZC on WinXP. Why does it make me type my WPA key twice? Why doesn’t it provide a way to turn on the damn echo, so I can see what I am typing. Yes I know it’s a password but after I type it for the 10th god damned time I don’t care anymore.

Oh, and for the love of god, why do you show 8 “circles” in the pre-filled password dialog regardless of how long my pass-phrase actually is? This does not inspire confidence.

Objects in dialog may be larger than they appear.

Apple’s Wifi config is seriously better. (Not that it needs to be… Their supplicant actually works.)

Outlook 2007 Instant Search

Outlook 2007’s instant search is just awful. It rarely shows me the results I want — I have to hunt them down manually. It’s like web search circa 1995.

Apparently others share my opinion.

Trust Relationship Has Failed

I’ve got some Vista laptops and virtual machines which are joined to the NT domain at work, but tend to be disconnected from that network for long periods of time. Ordinarily, this would be fine, but domain policy requires that we change our passwords every month.

Sometimes I get the following message on a log in attempt:

The trust relationship between the workstation and the primary domain controller has failed.

In these cases I’m often positive that I’ve entered the correct username and current password. Alas the machine has been away too long, and has lost the domain’s trust.

Where were you? Why didn’t you call? Is that lipstick on your collar?

The good news is that you can remedy this situation by merely rejoining the domain. The bad news is that you need to log in to the machine in order to do that. This is complicated by the fact that, by default, Vista has the local administrator account disabled.

In theory, Vista has cached your old credentials and can validate against those without contacting the domain. Just provide your old password from a couple months ago, and you’re good to go. You remember it… right?

One critical point: if the machine is connected to the network, it seems that it will ignore the old locally-cached credentials and try to validate against the domain. This is guaranteed to fail, because of the broken trust relationship. So, before you start brute-forcing, unplug that Cat-5. Turn off that WiFi.

Once you are logged in, do this:

  1. Leave the domain, do not reboot yet.
  2. Enable the local administrator and set a password.
  3. Reboot.
  4. Log in as the local admin and rejoin the domain.

If you can’t remember your old password you may have to “flatten” your machine. This is probably a good time to consider Ubuntu.

Rotate CMD.exe Colors

Call this function to rotate through different CMD.exe color schemes on Windows. Modify the COLOR_LIST variable as you like (see COLOR /? for details).


set CAR=%COLOR_LIST:~0,2%
set CDR=%COLOR_LIST:~-4%

color %CAR%

REM rotate w/ export hack
for %%D IN (1) DO (

exit /B

It might be desirable to change the line set COLOR_LIST=%CDR%%CAR% to instead use the setx command like this:


This sets a global environment variable instead of a local one which merely applies to the current CMD window and descendants.

Repair Outlook OST File

Outlook 2007 just crashed on me and, once again, was unable to restart successfully. Instead the following error message was presented:

Cannot start Microsoft Office Outlook. Cannot open the Outlook window. The set of folders cannot be opened.

In my case at least, the solution was to run:
C:\Program Files (x86)\Microsoft Office\Office12\scanost.exe

(I don’t understand why Outlook wouldn’t automatically attempt to repair these files following a failure to start. But I digress…)

If you Google this error message, as I did, you’ll notice that the results exhibit a very low signal-to-noise ratio. It seems that this particular Outlook error is highly overloaded — it occurs for a variety of reasons and thus has a variety of fixes.

Incidentally, this is why I decided to blog about it. I hope this saves someone some time.

While I’m in rant mode: Can we get some software vendors out there to require googleable error messages? I mean seriously. I should be able to Google any error message that could possibly come out of your product and immediately find an official page describing it. Bonus points if this page is a Wiki.

While you’re at it, please ditch the stupid “OK” button (no, screw you, it’s not OK) and replace it with “Google this error…”

Coping With Windows File Locking

I’ve run into this problem more times than I’d like to admit:

C:\>del foo.txt
The process cannot access the file because
it is being used by another process.

Umm, right, thanks. So should I just start killing processes indiscriminately? Perhaps now would be a good time for my daily sacrifice to the reboot gods?

Turns out there is a better way. I am not sure how I got this far without discovering handle.exe from SysInternals Microsoft:

C:\>handle foo.txt

Handle v3.2 (64-bit)
Copyright (C) 1997-2006 Mark Russinovich
Sysinternals -

evil.exe            pid: 6044     68: C:\foo.txt

Now I know exactly which process to kill with extreme prejudice.

Larry’s Filename Fixer for Windows

Reading Raymond’s post about bulk file renaming reminded me of Larry Wall’s filename fixer. This is a great thing to have in your toolbox. Here’s a minor tweak that allows it to work in Windows CMD.exe.

I call this renamer.cmd to avoid conflict with CMD’s much-less-useful built-in rename.

@rem = '
@echo off
perl -w %~f0 %*

# rename - Larry's filename fixer
$op = shift or die "Usage: renamer expr [files]\n";
chomp(@ARGV = <STDIN>) unless @ARGV;

# cmd.exe doesn't do glob expansion
@ARGV = map glob, @ARGV;

for (@ARGV) {
    $was = $_;
    eval $op;
    die $@ if $@;
    rename($was,$_) unless $was eq $_;

Oops! Who woulda thunk that the first Google hit for “Larry’s filename fixer” would be a book warez site? Link changed to point at Google’s Usenet archive.