Missing header, footer and page number templates in Office 2007

November 13, 2009 at 11:53 AMAndre Loker

Office 2007 seems to get confused if you install a language version different from the language Windows uses. I recently installed an English version of Windows 7 after having used a German version of Vista for two years. When I installed Office 2007 (German) on Windows 7 I realized that several gallery items in Word were missing:

noheader nopagenumber

I reinstalled Office without success. On the web I found some forum threads (e.g. here) describing the same issue but the most common solution was to delete a file called Building Blocks.dotx in %appdata%\Microsoft\Document Building Blocks\<some language id>. “some language id” is 1031 (German) in my case. However, deleting the file did not fix the issue. As predicted the file got recreated when Word was started, but the gallery items were still gone.

Out of the blue I guessed that maybe there was an issue with me using an English Windows and a German Office. So I copied the Building Blocks.dotx from the 1031 subfolder to a new folder named 1033 (which is the language code for English). And what can I say – it worked again!



Posted in: Tools | Windows

Tags: , , ,

Using Nant for Metabase backup on 64bit Windows Server 2003

January 28, 2009 at 4:26 PMAndre Loker

For while now I’ve been using NAnt not only as a build tool but also as the tool running all my backup tasks, such as:

  • database backups
  • Subversion repository backups
  • mail backup
  • website backup

I’ve also used it to create backups of the IIS Metabase using the iisback.vbs script, which works perfectly smooth as long as it is running on a 32 bit Windows.

I’ve been trying to backup the IIS Metabase on a 64 bit Windows Server 2003 server for a while now, but for some reasons I could not make it work. If I tried to call the script directly using the commandline, e.g.

   1: iisback.vbs /backup /s localhost /e something /v NEXT_VERSION 
   2:       /b Metabase123 //E:vbscript

it would ran perfectly fine. However, when executed as a NAnt task I got an error:

Could not create an instance of the CmdLib object.
Please register the Microsoft.CmdLib component.

After digging in the dark for a while I found an interesting forum thread of somebody with a similar problem. So I more or less did what has been proposed in that thread:

  1. I copied cmdlib.wsc over from %WINDIR%\System32 to %WINDIR%\SysWOW64
  2. I also copied isschlp.wsc the same way
  3. I registered cmdlib.wsc and isschlp.wsc using regsvr32 cmdlib.wsc and regsvr32 isschlp.wsc respectively

At that point my NAnt script was happy again and created the backups.

The reason and more trouble

As far as I understand the problem was that NAnt is for some reason running as a 32 bit application. On 64bit Windows boxes, the System32 folder contains the 64bit binaries whereas the SysWOW64 folder contains the 32bit versions. Frankly, this is not the most intuitive naming ever, but it has a reason. If a 32 bit application is running the System32 folder becomes an alias for the SysWOW64 folder, with the effect that for 32 bit applications, Windows looks totally normal (ie. 32 bit). However, this also means that binaries that are found in the unaliased System32 folder are not accessible for 32 bit application. Hence the need to copy and reregister cmdlib.wsc and isshlp.wsc.

Now that I had this one working I directly faced a second problem: the backups of the metabase are stored at %WINDIR%\System32\inetserv\MetaBack. I think you can guess what’s the problem: the folder is hidden for 32 bit applications, which means that I can’t copy the Metabase backups using NAnt, because NAnt only sees the aliased version of System32.

So here’s what I did to solve this issue: I couldn’t find a way to disable the file system aliasing though standard means in NAnt, but I found an API that could help me:

Using the first of those two method disables the aliasing for the current thread. So I wrote a small C# program that first disables the aliasing (by P/Invoking the methods mentioned above) and then copies the backed up files out of the System32 folder into a conventional folder. I could then continue to use NAnt to further process those files (e.g. zipping them, mailing them somewhere – whatever).

Here’s the code of the class that disables/reverts the file system aliasing:

   1: /// <summary>
   2: /// Disables file system aliasing for 32 bit applications
   3: /// on 64 bit systems.
   4: /// </summary>
   5: public class DisableWow64Redirect : IDisposable {
   6:   #region P/invoke
   7:   [DllImport("Kernel32")]
   8:   private static extern bool Wow64DisableWow64FsRedirection(out IntPtr oldValue);
  10:   [DllImport("Kernel32")]
  11:   private static extern bool Wow64RevertWow64FsRedirection(IntPtr oldValue)
  12:   #endregion
  14:   private readonly IntPtr oldValue;
  16:   /// <summary>
  17:   /// Creating a new object disables file system aliasing for the current thread.
  18:   /// </summary>
  19:   /// <remarks>
  20:   /// Use <see cref="Dispose"/> to re-enable file system aliasing.</remarks>
  21:   public DisableWow64Redirect() {
  22:     Success = Wow64DisableWow64FsRedirection(out oldValue);
  23:   }
  25:   public bool Success { get; private set; }
  27:   /// <summary>
  28:   /// Disposes this object and reenables the file system aliasing.
  29:   /// </summary>
  30:   public void Dispose() {
  31:     if (Success) {
  32:       Success = Wow64RevertWow64FsRedirection(oldValue);
  33:     }
  34:   }
  35: }

Granted, this is probably not the best solution one could think of, but it works for me for the moment. If anyone has a better idea, let me know!


Posted in: Windows | Snippets | C#

Tags: , ,

How to enable sound in Remote Desktop sessions on WinServer 2k3

August 26, 2008 at 1:46 PMAndre Loker

On a Windows Server 2003 machine I needed sound to be enabled during remote desktop connections. Here's what I had to do to bring the sound to the client machine.

  1. Install audio drivers on the server, of course
  2. Enable the Windows Audio service on the server.
    1. Open Administrative Tools => Services
    2. Locate the service named Windows Audio
    3. Set the start mode to "Automatic" and start the service
  3. Enable RDP-Tcp Audio Mapping
    1. Open Administrative Tools => Terminal Services Configuration
    2. Select the "Connections" node on the left side
    3. Right click on RDP-Tcp on the right side and select "Properties" (or double click RDP-Tcp)
    4. On the "Client Settings" tab, uncheck "Audio mapping"  (checked items are disabled)
  4. In the Remote Desktop Connection window (client side), enable audio playback on client computer
    1. Show options by clicking "Options >>"
    2. On the "Local Resources" tab, select "Bring to this computer" in the combo box under "Remote computer sound"
  5. Connect to the remote server and you should have sound.

Note: you should only enable sound on the server if you have a good reason, e.g. I edit my DVB-T recordings on the server. Otherwise, leave audio off for stability and security reasons.

Posted in: Windows

Tags: , ,

Finally - stuff for the Vista Ultima users (insert irony here)

May 2, 2008 at 11:51 AMAndre Loker

Many users of Vista Ultimate have complained that Microsoft did not release a lot of useful extras exclusively to Ultimate users. To sum it up, until now, we got:

  • DreamScene. Call me ignorant, but actually I am not sitting in front of my PC watching videos that play on my desktop all day long.
  • BitLocker and EFS extensions. Although I am not using BitLocker nor EFS, let alone the extensions, this extra might be of some use.
  • Texas Hold'em Poker. No comment...

But today I found a new entry in Windows Update: *drumroll* two brand new sound schemes called "Glass" and "Pearls" provided exclusively to Ultimate users! Hooray!

If someone noticed irony in the previous paragraph it's no coincidence. Really, of all the nifty things that MS could have thought up, two new sound schemes are disappointing to say the least. It is not only that I don't use sound schemes at all. The two schemes are not that spectacular in the first place. Oh, by the way, for those who really don't have anything else to do than watching DreamScene videos, there is some new content available as well.

Come on Microsoft, I know you can do (much) better than this!

Posted in: Windows

Tags: , ,

Vista SP1: Neue Fehlerseite im IIS

April 9, 2008 at 1:04 PMAndre Loker

Nach der Installation von SP1 scheint der IIS neue Fehlerseiten erhalten zu haben. Siehe Bild.


Posted in: IIS | Windows

Tags: , ,