Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

In server core, after a restart powershell was all of a sudden not installed, what do I do to reinstall it?

I do not have remote administration set up yet so I cannot use that to re-install it.

'powershell' is not recognized as an internal or external command, operable program, or batch file.

share|improve this question
    
Did you verify the binaries are gone? It could be as simple as your %PATH% variable missing/broken. –  jscott Sep 22 '12 at 22:51
2  
Yes, the binaries are gone. C:\Windows\System32\WindowsPowershell\v1.0\ was empty –  Steven Quan Sep 22 '12 at 23:43

2 Answers 2

up vote 6 down vote accepted

Use the Deployment Image Servicing and Management (DISM.exe) tool to enable PowerShell:

dism.exe /online /enable-feature /featurename:MicrosoftWindowsPowerShellRoot

...or if that's not enough:

dism.exe /online /enable-feature /featurename:MicrosoftWindowsPowerShell /all

share|improve this answer
    
I did try that, where was no option to install Powershell and enabling remote management did not do anything to install it –  Steven Quan Sep 22 '12 at 23:42
    
The second method worked, thank you so much! –  Steven Quan Sep 22 '12 at 23:53
    
Good to read this solved your problem. Thanks. –  mweisel Sep 23 '12 at 0:01
    
Thanks. Although I had to append /all onto the end of the second command. I accidentally removed a feature in 2012's server manager and had to use this to get back on my feet again. After that I followed this guide: telnet25.wordpress.com/2012/09/21/server-core-install-gui –  maxp Oct 19 '12 at 11:23
    
I get the error "DISM does not suport servicing Windows PE with the /Online option ??? –  Sinaesthetic Sep 27 at 0:59
dism.exe /online /enable-feature /featurename:MicrosoftWindowsPowerShellRoot
dism.exe /online /enable-feature /featurename:MicrosoftWindowsPowerShell /all

Say "yes" for reboot.

powershell
Add-WindowsFeature Server-Gui-Shell, Server-Gui-Mgmt-Infra
Shutdown –r -t 0
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.