PowerShell Closes Immediately When Launched; Machine.Config Parser Error

When you run PowerShell.exe, the PowerShell window may open and close immediately before you can read the error message. Running PowerShell.exe from an existing Command Prompt window, or opening PowerShell via Windows Terminal may show the error message:

The shell cannot be started. A failure occurred during initialization:
The type initializer for 'System.Net.ServicePointManager' threw an exception.

[process exited with code 4294901760 (0xffff0000)]
You can now close this terminal with Ctrl+D, or press Enter to restart.

The shell cannot be started. The type initializer for 'System.Net.ServicePointManager' threw an exception

Some .NET apps may throw the following error:

Configuration parser error

Error parsing C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config

Parser returned error 0xC00CE556.

machine.config parser error 0xC00CE556

Cause

The above errors occur if the file machine.config is corrupt. This configuration file is presumably used by many .NET-based apps.



Resolution

To resolve the issue of the PowerShell window closing immediately after the launch and the Parser error 0xC00CE556, replace “Machine.Config” with a fresh copy using these steps.

  • Open the following folder:
    C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config
    Note: The folder path is mentioned in the error message above. Alternatively, you can find the correct folder name (version) by reading the “RuntimeVersion” registry value in the following registry key:

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine

    -or-

    1. Open the folder “C:\Windows\Microsoft.NET\
    2. Open the folder named “Framework” or “Framework64” (depending upon your OS bitness).
    3. Select specific version folder e.g., “v4.0.30319
    4. Double-click the “Config” folder.
    5. The “Config” folder will contain the files, “Machine.config” and “Machine.config.default“.
  • In the above folder, delete the file named machine.config.
  • There should be another file named machine.config.default in that folder. Make a copy of machine.config.default.
  • Name the copy as machine.config.

Using Command Prompt

If you wish to accomplish the above steps using Command Prompt or Batch files, here are the commands:

cd /d C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config
del machine.config
copy machine.config.default machine.config

machine.config fix file

That’s it! Open PowerShell. You should no longer get the error.


One small request: If you liked this post, please share this?

One "tiny" share from you would seriously help a lot with the growth of this blog. Some great suggestions:
  • Pin it!
  • Share it to your favorite blog + Facebook, Reddit
  • Tweet it!
So thank you so much for your support. It won't take more than 10 seconds of your time. The share buttons are right below. :)

Ramesh Srinivasan is passionate about Microsoft technologies and he has been a consecutive ten-time recipient of the Microsoft Most Valuable Professional award in the Windows Shell/Desktop Experience category, from 2003 to 2012. He loves to troubleshoot and write about Windows. Ramesh founded Winhelponline.com in 2005.

Leave a Reply