none
CScript Error: Can't change default script host

    Question

  • Brand new install of Windows Server 2012.

    Attempting to run "CScript //H:CScript" generates this error: CScript Error: Can't change default script host.

    Attempted using Domain Administrator and local Administrator accounts, as well as elevated command prompt (run as administrator).

    Running "WScript //H:CScript" generates the same error (Can't change default script host) in a Windows Script Host dialog.

    HKCR\VBSFile\Shell\Open\Command = "%SystemRoot%\System32\WScript.exe" "%1" %*

    HKCR\VBSFile\Shell\Open2\Command = "%SystemRoot%\System32\CScript.exe" "%1" %*

    Why can't I change the default script host?


    • Edited by desmondgc Monday, November 19, 2012 2:07 PM typo
    Thursday, November 15, 2012 6:52 PM

Answers

  • Issue was related to Python install on the server.

    I ran ProcessMonitor to see where CScript was failing. It appears to scan the HKCR hive for file types / extensions, but would exit with error code 1 immediately after loading the .pys / pysFile keys. I am not sure whether it failed because of .pys or the "next" entry (.pyw) and am still not sure _why_ this caused it to fail. Uninstalling Python did not resolve the issue - had to reinstall Windows Server and set CScript default first before reinstalling Python.

    This was never an issue on Windows Server 2008 or any previous version.

    • Marked as answer by desmondgc Monday, November 19, 2012 2:21 PM
    Monday, November 19, 2012 2:21 PM

All replies

  • works fine for me.  Are you having the problem on any other 2012 installs?

    tim

    Saturday, November 17, 2012 12:08 AM
  • On Sat, 17 Nov 2012 00:08:10 +0000, Tim Cerling wrote:

    works fine for me.? Are you having the problem on any other 2012 installs?

    I get the same results as Tim, I have no problem changing back and forth
    between the two.


    Paul Adare
    MVP - Forefront Identity Manager
    http://www.identit.ca
    Any program that runs right is obsolete.

    Saturday, November 17, 2012 6:45 AM
  • Issue was related to Python install on the server.

    I ran ProcessMonitor to see where CScript was failing. It appears to scan the HKCR hive for file types / extensions, but would exit with error code 1 immediately after loading the .pys / pysFile keys. I am not sure whether it failed because of .pys or the "next" entry (.pyw) and am still not sure _why_ this caused it to fail. Uninstalling Python did not resolve the issue - had to reinstall Windows Server and set CScript default first before reinstalling Python.

    This was never an issue on Windows Server 2008 or any previous version.

    • Marked as answer by desmondgc Monday, November 19, 2012 2:21 PM
    Monday, November 19, 2012 2:21 PM
  • Thanks for sharing.
    Tuesday, November 20, 2012 2:22 AM
  • Uninstalling Python doesn't remove the file assocations. I got "cscript //H:CScript" working on Server 2008 (not Server 2012, I know) by deleting all the Python-related keys (Python, pysFile, pys etc.) under HKCR.
    Tuesday, May 28, 2013 3:37 PM