Automating the world one-liner at a time…
Good things come to those who wait. Please download these bits and let us know if you have any problems with them.
Just to be clear, this download contains the latest version of both PowerShell and WINRM.
Jeffrey Snover [MSFT]Distinguished EngineerVisit the Windows PowerShell Team blog at: http://blogs.msdn.com/PowerShellVisit the Windows PowerShell ScriptCenter at: http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx
OK, someone made a suggestion on the Connect to use ngen uninstall.
There is a workaround that worked for me:
Basically, you need to remove bogus "compile assembly" entry using "ngen uninstall" command. On my system I had to run ngen uninstall multiple times for various PowerShell assemblies.
To get the idea what assembly to remove, check NGEN service log file %SystemRoot%\Microsoft.NET\Framework\v2.0.50727\ngen_service.log.
The last entry is what crashed the service. E.g.
09/27/2009 18:31:33 : Error compiling Microsoft.PowerShell.Security.resources,Version=126.96.36.199,Culture=%PowerShell_Culture%,PublicKeyToken=31bf3856ad364e35,ProcessorArchitecture=msil: The system cannot find the file specified. (Exception from HRESULT: 0x80070002)
Command line to run then will be (in %SystemRoot%\Microsoft.NET\Framework\v2.0.50727 folder)
ngen uninstall Microsoft.PowerShell.Security.resources,Version=188.8.131.52,Culture=%PowerShell_Culture%,PublicKeyToken=31bf3856ad364e35,ProcessorArchitecture=msil
After you executed ngen uninstall, you might need to start the .NET Runtime Optimization service.
If it crashes, you'd have to check the log again and get the name of the next assembly to uninstall.
Using a log monitoring utility like tail (or get-content -wait) in a separate window might make it easier.
Using NGEN Uninstall fixes the crash of the .Net Runtime Optimization Service.
However, the downloaded package will still not install. It continue to loop the PSCustomSetupUtil error and put the .Net Runtime Optimization Service back in the broken state. Something is still wrong with the install package.
I have un-installed all previous version of Power Shell.
Like the others, I am running a lot of software on top of .Net 3.5 SP+, so an answer of "uninstall" all your stuff is UNACCEPTABLE!
I do not have 2 days to fix my computer and re-install everything.
I would get fired if I wrote an instalation package that didn't report the actual problem so I could fix it.
I was able to follow the uninstall NGEN services directions that Seva provided and all seems to be working now. I do agree with Al that this manual process really should have been handled by the Microsoft PowerShell team instead of finding the answer in a blog post comment.