Windows – How to repair powershell installation on windows 7

powershellwindows 7

When I try to run powershell.exe from C:\Windows\System32\WindowsPowerShell\v1.0 I get the error: 'The volume for a file has been externally altered so that the opened file is no longer valid.'

I have not been able to find out why I get this error. If I make a copy of the powershell.exe and run it, no problems.

So I thought I'd just remove powershell and install it again. But how can I do this with Windows 7? Powershell does not appear in the Control Panel 'Programs and Features' list.

Manually deleting the powershell.exe file does not work either – I am told that I require permission from TrustedInstaller in order to change the file.

Anyone got any ideas?

— UPDATE —

I installed WMF 3, as suggested in the comment, but still get the same error when running powershell.exe.

My current workaround is quite horrible – I just made a new folder containing a copy of the powershell.exe, added it to the windows PATH, and removed the standard system32\WindowsPowershell\v1.0 folder from the path)

Best Answer

Try running System File Checker. If the file is corrupt it (SFC) should detect it and replace it with the correct one from Windows' installation media (which you might have to supply).

You can read how to do this here: http://support.microsoft.com/kb/929833

or open a command prompt with administrative power (Start > search for "cmd" > right click and select "Run as administrator") and enter:

sfc /scannow

It will work and then give you a message, which should say corrupt files have been repaired. Restart to be safe, and then try PowerShell again.