Monday 5 April 2010

Windows Server 2008 R2 Core

Ok, so you might be wondering what that has to do with Powershell.  Hopefully by the end of this post you might know why I am posting this.  I am writing about Microsoft Windows Server 2008 R2 core as this has the ability to install Powershell (some hacks have been preformed to get it onto 2008 original but these aren’t supported)
Firstly I’ll let Microsoft introduce what Server Core is for if you are unaware:
The Server Core installation option for the Microsoft Windows Server 2008 R2 operating system provides a minimal environment for running specific server roles that reduces the maintenance and management requirements and the attack surface for those server roles.
So with being cut back the main thing to go is the GUI leaving you with only a command prompt window to work with.  You will find you need a couple of commands to get you to the point of where you can install Powershell and get back to a more sensible console.  A quick reference sheet is available here.  What I plan to do here is go through what you have to do to get from a clean install to be working with Powershell.  I’m starting from the point of the installation finishing and having chosen my password.
  • When you log in you will be presented with a cmd.exe, this is it, don’t expect any more as it’s not coming.
  • At this stage the name of the computer is fairly random. I’m just on a workgroup for now so to rename the computer I need to type:

    • netdom renamecomputer %computername% /NewName:**
    • After a reboot the name will be changed
    • you can check the name with the “echo %computername% command
  • Many services require a static IP address, however I am not setting up anything that is dependent on that and as the quick reference sheet is clear on how to do that I’ll skip over it for here.
  • Next up we’ll look at what roles and services are enabled and disabled, to do this we use the Dism command as follows:

    • dism /online /get-features /format:table
  • If you look up the list you will find a service called “MicrosoftWindowsPowerShell” and this is set to disabled by default.  When you find what you want installed type the following:

    • start /w ocsetup name_as_above
(Thanks to Jeffrey Hicks for letting me know an easier way)
  • To get Powershell you will need to first have .net framework 2.0 running (NetFx2-ServerCore)then turn on powershell as follows (please note names are caps sensitive):

    • start /w ocsetup NetFx2-ServerCore
    • start /w ocsetup MicrosoftWindowsPowerShell
  • you can now start Powershell by going to:
    • %systemroot%\system32\WindowsPowerShell\v1.0 then running Powershell.exe
  • Now you can get a list of Roles and Features by:
    • Import-Module ServerManager
    • Get-WindowsFeature
      • You can also add and remove using the Add-WindowsFeature and Remove-WindowsFeature comlets.
Jeffrey Hicks has a great blog post about setting Powershell as your default shell here: PowerShell Quick Start on Server Core R2 - The Lonely Administrator – Do this on a test server to start with so you don’t end up breaking your server
I hope this is a good start and to find out more check out the Podcast Episode 110 when they are talking to “The Server Core Guy”.

1 comment:

  1. The Server Core show is being bumped to the following week to accommodate the guest. We'll do something special on the 8th.