8

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.

2 Answers2

8

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

MGOwen
  • 307
  • 2
  • 4
  • 11
mweisel
  • 556
  • 3
  • 4
  • 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
  • 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: http://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 '14 at 00:59
2
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

In server 2012 R2 Use Shutdown /r /t 0

Esa Jokinen
  • 46,944
  • 3
  • 83
  • 129
geekgirl
  • 21
  • 1