Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
Yes, the binaries are gone. C:\Windows\System32\WindowsPowershell\v1.0\ was empty – 124597627895789645856485 Sep 22 '12 at 23:43
up vote 8 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 – 124597627895789645856485 Sep 22 '12 at 23:42
The second method worked, thank you so much! – 124597627895789645856485 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: – 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 '14 at 0:59
dism.exe /online /enable-feature /featurename:MicrosoftWindowsPowerShellRoot
dism.exe /online /enable-feature /featurename:MicrosoftWindowsPowerShell /all

Say "yes" for reboot.

Add-WindowsFeature Server-Gui-Shell, Server-Gui-Mgmt-Infra
Shutdown -r -t 0

In server 2012 R2 Use Shutdown /r /t 0

share|improve this answer

protected by Michael Hampton Aug 13 '15 at 15:59

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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