Search code examples
c#.netwindows64-bitwow64

How can I start ServerManager.msc on a 64bit Windows Server 2008 from a 32bit .NET App?


I have the following scenario:
- 64bit Windows Server 2008.
- 32bit .NET application (needs to be x86 for various reasons).
- I need to start ServerManager.msc from my .NET application.

When using Process.Start("ServerManager.msc"), I get the following exception:
System.ComponentModel.Win32Exception.
Message="The system cannot find the file specified".

On a 32bit Windows Server 2008 the code works fine...
I tried to inlcude the full path to ServerManager.msc, but that does not help either.
Also no difference if running with or without admin privileges.

Any ideas?


Solution

  • On WOW64, if a 32-bit application refers to C:\Windows\System32; the operating system transparently remaps this to C:\Windows\SysWOW64 (which is where the 32-bit stuff lives).

    As a 32-bit application on Win64, you need to specify the full path as %SYSTEMROOT%\SysNative\ServerManager.msc.

    SysNative doesn't exist on x86 Windows (there's no reverse mapping, at least on Win7 Ultimate), so you'll need to figure out whether you're on x86 or x64 first.