The great thing about the Server Core flavor that ships with Windows Server 2008 R2 is that it finally supports Windows PowerShell. I’ve talked about this before. However, I think I neglected some of the finer points in getting started. You can (and should) run PowerShell on your R2 Core servers. More than likely you will first have to install it.
ManageEngine ADManager Plus - Download Free Trial
Exclusive offer on ADManager Plus for US and UK regions. Claim now!
After you’ve started the server and logged on as an administrator, at the C: prompt run this command first:
C:\> start /wait ocsetup NetFx2-ServerCore
This will load the requisite .NET Framework. Once installed, you can setup Windows PowerShell.
C:\> start /wait ocsetup MicrosoftWindowsPowerShell
The main reason you want this is because Server Core does not support SetupManagerCMD. Instead you’ll find it easier to start PowerShell from the C: prompt.
C:\> powershell
Once in PowerShell, load the ServerManager module.
PS C:\> import-module ServerManager
Now you’ll have access to the Add-WindowsFeature cmdlet. This is a much easier way to add roles and features. Of course, I prefer to then manage them remotely from another full server. Or even better, use the Remote Server Administration Tools on Windows 7.
While you’re at it, you should also configure the server’s execution policy and WinRM settings for remoting, assuming you aren’t using Group Policy.
PS C:\> set-executionpolicy remotesigned
PS C:\> enable-psremoting
If you want to see how to make PowerShell the default shell on Server Core, take a look back at this post from earlier this year.
Finally, if you accidentally exit your PowerShell session you’ll be left with an empty desktop. Press Ctrl-Alt-Del and either log off so you can log on again. Or choose Task Manager. In Task Manager, go to File – NewTask (Run) and type powershell. Or if you need the legacy shell type cmd. You can have as many shells open as you want.
I’m very interested to hear about your experiences with PowerShell on Server Core.
Followup: I assumed server manager was already installed. To be able to use the ServerManager module it first needs to be installed:
start /wait ocsetup ServerManager-PSH-Cmdlets
It may be important to remember that this only installs the 64-bit compatible PowerShell. If you’re running 32-bit applications (I was testing SSH servers), they won’t “see” PowerShell.
To install the 32-bit version, run the same 2 “start” commands above, but just tag on “-WOW64” to the end of the command-line (no spaces).