Server Core installations of Windows Server 2008 R2 and installations of Hyper-V Server 2008 R2 offer Windows PowerShell. A lot has been written on the geekiness of PowerShell, how it wasn’t included in Server Core installations of Windows Server 2008 R2 and how you could enable it anyway. The question however is, how do you get started with using PowerShell in Server Core?
This blogpost shows you how to install PowerShell, how to start it up and issue some basic commands.
Installing PowerShell
To install Windows Powershell on a Server Core installation of Windows Server 2008 R2, issue the following three commands:
dism /online /enable-feature /featurename:NetFx2-ServerCore
dism /online /enable-feature /featurename:MicrosoftWindowsPowerShell
dism /online /enable-feature /featurename:ServerManager-PSH-Cmdlets
These commands will install the .Net Framework 2.0 binaries. This is a package, Windows PowerShell depends on. After you’ve successfully installed the .Net Framework you can install Windows PowerShell. Use the last command to be able to use the built-in PowerShell cmdlets for Server Manager.
Note:
The above commands are case sensitive.
If you also need 32bit support in Windows Powershell, also issue the following two (again: case sensitive) commands:
dism /online /enable-feature /featurename:NetFx2-ServerCore-WOW64
dism /online /enable-feature /featurename:MicrosoftWindowsPowerShell-WOW64
Tip!
You don’t need to install the base Windows on Windows (WoW) 64 package into a Server Core installation of Windows Server 2008 R2. This package is installed by default.
Starting PowerShell
To start using PowerShell you need to start it up. For some strange reason the path where PowerShell resides is not added to the %PATH% variable after installing, so you need to drill down to it, before you can start PowerShell.
Use the following commands:
cd C:\Windows\system32\WindowsPowerShell\v1.0
powershell
Now PowerShell is started. (Congratulations! 🙂 )
Showing off PowerShell
One of the strongest examples of the strength of PowerShell is the ability to add and remove Server Roles and Server Features, without the need to worry whether you’re typing them right. (remember, the dism.exe command is case-sensitive)
for instance, on the PowerShell you can use the following command to install the Windows on Windows (WoW) 64 support for .Net Framework 2.0:
PS > enable-windowsfeature netFX2-ServerCore-WoW64
Also, one of the nice benefit of using the get-windowsfeature PowerShell cmdlet is you get the hierarchy, instead of the long list of Server Roles and Features you get when you use dism /online /get-features. See for yourselves, when you execute the following command:
PS > import-module ServerManager
PS > get-windowsfeature
Further reading
Windows Server Core: Overview
Learning Windows Server 2008 R2 – Server Core…
Windows Server 2008 R2 Rocks!
How to enable PowerShell in Hyper-V Server 2008 R2
Setup Core Configurator on Windows Server 2008 R2
Using PowerShell on Windows Server 2008 R2 Server Core
Has Microsoft redeemed itself?
Login