Search code examples
iiswow64wsh

CScript on x64 Win2003 Server - Cannot find script file


Sanity check, please. The solution I'm hearing sounds ill-conceived, but may be the only one.

From within an .hta over .vbs app I'm running

cscript c:\Windows\System32\iisapp.vbs

It works great from the CLI and fails from within my little app. This is because I'm on a 64 bit box, and my calls to c:\Windows\System32 are redirected to c:\Windows\SysWow64, where the iisapp.vbs script does not reside. Moving the script over there causes Microsoft.CmdLib to complain about needing to be registered. All of this is understandable and understood.

The recommended solution on other forums is to copy and regsvr32 IIsScHlp.wsc and cmdlib.wsc to SysWow64.

That works, but it seems a bit heavy-handed. Might there be unforeseen side-effects of this solution? Is there not a more direct solution than reregistering these files over into Wow64-land?

Thanks.


Solution

  • Looks like you need to access the 64-bit "System32" directory on a 64-bit box from a 32-bit program. The easiest way to do that is to use the virtual directory "Sysnative" instead of System32 like this:

    cscript c:\Windows\Sysnative\iisapp.vbs
    

    Alternatively you could start the 64-bit version of cscript:

    %windir%\Sysnative\cscript c:\Windows\System32\iisapp.vbs
    

    More info on Sysnative can be found in this blog article.