Welcome to Dirteam.com/ActiveDir.org Blogs Sign in | Join | Help

The things that are better left unspoken

a blog by Sander Berkouwer

Related

AD Manager Plus
 

Blog roll

News



Archives

How to get going with PowerShell in Server Core R2

Powershell 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! Cool )

   

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?

Posted: Tuesday, February 02, 2010 4:31 PM by Sander Berkouwer

Comments

Active Directory Round Up 2/4/2010 - The Experts Community said:

Speaking of PowerShell, here is a short but informative article on how to add PowerShell to Server Core in Windows Server 2008 R2. The original flavor of Server Core in Server 2008 could not run PowerShell at all. But R2 has rectified that situation. Although I have to say when I installed an R2 Server Core not too long ago, I thought PowerShell was installed by default. If it is installed, all you need to do is type PowerShell at a C: prompt and you should get a PS C:\> prompt indicating PowerShell is running.  If you don't have PowerShell, then follow the steps in this article. I've also posted steps on how to change the default shell in an R2 Server Core from the CMD shell to PowerShell.

# February 4, 2010 4:06 PM
Anonymous comments are disabled