PowerShell on Server Core

[UPDATE] Instructions below are for Windows Server 2008 which does not have PowerShell or .NET support for Server Core. Windows Server 2008 R2 released later, has native support for these, so you can simply follow these Microsoft instructions to enable PowerShell there: http://support.microsoft.com/kb/976736

Below is a step-by-step instruction on installing Windows PowerShell on Windows Server 2008 in Server Core mode.

Note that these are in no way official or supported by Microsoft. Microsoft is working on official version of .NET and PowerShell for Server Core installations, so eventually you will be able to get this fully supported. Until then below are the instructions you can use at your own risk, etc., etc.

Quick Introduction

Windows Server 2008 has a command-line installation option – Server Core – which significantly reduces the attack surface and patch requirements by the virtue of not having Explorer and other UI components not needed in datacenter.

The problem is that it only ships with traditional cmd.exe and not PowerShell. To make things worse neither PowerShell nor .NET as they are today can be installed on such systems.

Below are the steps you can take to create packages of these tools which can be installed. Basically the whole procedure consists of just four main steps:

  1. Installing Visual C++ Redistributable Packages (required for .NET).
  2. Installing .NET 2.0 SP1
  3. Installing PowerShell.
  4. Jumping around the computer and shouting “I’ve got it!”

So let’s get started!

1. Visual C++ Redistributable Packages

This is the easiest one. All you need to do is download the packages you need:

After that, copy these files to your Server Core computer (e.g. using Robocopy) and simply run them there.

If your Server Core is 32-bit – just run vcredist_x86.exe.
If it is 64-bit, you need to install both x86 and x64 versions (vcredist_x86.exe and vcredist_x64.exe).

2. .NET Framework

This is the most tricky part. PowerShell needs .NET 2.0 and .NET 2.0 is supposed to be a component of Windows Server 2008 so we will have to get a package of the framework which can get installed on such a system. To accomplish that we will:

  1. Download .NET Framework 3.5.
  2. Unpack the setup to get access to the .NET 2.0 Service Pack 1 installation files.
  3. Download and install the Orca MSI editor.
  4. Use Orca to remove the Windows version check.
  5. Run the updated MSI.

2.1. Download .NET: Go to Microsoft’s web site and download full redistributable package of .NET 3.5.

2.2. Unpack the file:
a. Create a folder c:\deploy
b. Save the downloaded .NET framework package to this folder.
c. Download the wonderful deploy.cmd script which Artem has posted and put it into the same folder.
d. Run the script.

After the script executes, the C:\Deploy\AIP folder will have both NetFx20_x64 and NetFx20_x86 folders with .NET 2.0 framework files you need.

2.3. Install Orca:

This is great but unfortunately you cannot just install the files because the MSIs are specifically checking for Windows version. So now we need to disable this check. To do this we will use Microsoft’s Orca MSI editor.

Note: This all needs to be done on a regular, not Server Core, machine. We will copy the results of our Orca operations to the Core box later on.

If you don’t have Orca, follow these steps to download it:
a. Download the Windows SDK for Windows Server 2008 and .NET Framework 3.5 installer.
b. Run the installer and deselect everything except Win32 Developer Tools (this will make sure that you only download the few megs you need.)

Downloading Orca

c. After the installation completes, go to C:\Program Files\Microsoft SDKs\Windows\v6.1\Bin and install Orca.msi.

2.4. Tweak the setup:

Now its time to do some patching.
a. Start Orca and open the MSI you need (C:\Deploy\AIP\NetFx20_x86\NetFx20a_x86.msi for 32-bit version or C:\Deploy\AIP\NetFx20_x64\NetFx20a_x64.msi for x64).
b. Click Component.
c. In x86 locate: Regtlib.exe_Tool_____X86.3643236F_FC70_11D3_A536_0090278A1BB8
In x64 locate that one and Regtlib.exe_Tool_____A64.3643236F_FC70_11D3_A536_0090278A1BB8
d. Change the Condition from (VersionNT < 600) or Version9X to just VersionNT or Version9X.

Allow .NET 2.0 Framework to get installed on Windows Server 2008

e. Save changes (either to that same MSI or a transform file.)

2.5. Install .NET

Copy the files (the whole folder) to your core machine and start the MSI via this command line (note that you need to use msiexec in order to pass the vsextui=1 parameter):

If you saved a transformed file and are running 64-bit version you will probably run:
%SystemRoot%\system32\msiexec.exe /package "NetFx20_x64\NetFx20a_x64.msi" vsextui=1 transforms="ServerCore.mst"

On x86 without a transform that would be:

%SystemRoot%\system32\msiexec.exe /package "NetFx20_x86\NetFx20a_x86.msi" vsextui=1

That’s it. Now we have .NET installed and can go to the final step – PowerShell installation!

3. Windows PowerShell

There is no PowerShell v1 setup for Windows 2008 (again, because it is supposed to be a component) but you can actually download and install the CTP (note: this is a pre-beta code – not for production use). PowerShell v2 CTP2 is available from Microsoft’s downloads page.

Download the version you need, copy the msi over to the Server Core box and simply run the msi.

4. Enjoy!

Now you can start PowerShell!

Just run:
c:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe

And you will see the prompt change to: PS C:>

That’s it. Now you are among the first geeks in the Universe to have PowerShell on Server Core!

PowerShell v2 running on Windows Server 2008 Server Core

Acknowledgments: I could only have this all accomplished thanks to the help I got from Alex Kibkalo and a great post by Artem Pronichkin on installing .NET on Server Core.

Tags: , , , ,

78 Responses to “PowerShell on Server Core”


  1. 1 Preston May 15, 2008 at 5:55 pm

    Very sweet! Too bad it isn’t supported- that means this won’t make it out of the lab because of policy. D’oh!

  2. 2 Max Trinidad May 15, 2008 at 6:16 pm

    GREAT Article!!! This is awesome. I knew that its possible and now you gave steps in How-to. I will be putting it to work within the next few days. Thanks.

  3. 3 don May 15, 2008 at 8:11 pm

    what does this do to maintenance? Will software update patch these hacked-in components? If not this seems to defeat the whole small-footprint lower-maint goal of server core. Does psh on core offer an advantage? Wouldn’t it push toward local management rather than remote, as intended?

  4. 4 dmitrysotnikov May 15, 2008 at 8:17 pm

    Don,

    Please read the post again. Right now this is an unsupported configuration. If you deploy it you have to take care of patching, etc.

    When official package is released by Microsoft you will obviously be able to rely on their patching.

    PowerShell on core (especially when cmdlets become available for core specific management) will offer significant advantages over the current set of utilities managed from cmd.exe. Are we there already? Not yet, but this is coming and will eventually make Server Core a much more compelling story.

    Dmitry

  5. 5 matthew May 16, 2008 at 12:08 am

    Awesome.

  6. 6 Richard May 16, 2008 at 8:45 am

    Brilliant

    Thanks for this

  7. 7 thomas lee May 16, 2008 at 3:49 pm

    Awesome.

    You rock dude!

  8. 8 Max Trinidad May 17, 2008 at 6:48 pm

    Dmitry, once again for a great blog. I found myself some pitfalls in the section of upackaging the .NET Framework 3.5 so I blog on the steps for those who might end up in the same situation. Now, I can remotely connect to my test Server Cores and run PowerShell scripts.
    🙂

  9. 9 dmitrysotnikov May 18, 2008 at 6:27 pm

    Thanks Max! I guess I should have been more explicit in the Orca section: Yes, Orca needs to be installed and used on a regular computer, and you only need to copy the processed files to the Core afterwards.

  10. 10 Pronichkin May 19, 2008 at 7:21 am

    Thanks Dmitry, I’ve added a link here in the beginning of my post.

  11. 11 laszlo May 22, 2008 at 5:23 pm

    Strange, trying to execute SDK setup.exe application warns me it cannot be installed because it needs Framework 2 in order to continue.

    Well, recapitulating, I use SDK in order to install Framework but SDK need Framework to be installed … I get crazy lol

    Any idea of what’s happening ?

  12. 12 laszlo May 22, 2008 at 5:25 pm

    Alright, I apologize

    Reading previous posts, author gave the logical answer : install orca in another computer …

    Insert it directly in the doc 😉

    Thx boyz

  13. 13 Daitox June 15, 2008 at 7:08 am

    The folders in deploy dont get filled with that script for me (windows xp sp3).

  14. 14 Daitox June 15, 2008 at 7:11 am

    Okay, copied it to a different drive, edited the work folder in the script and it worked perfectly now.

    Going to continue.

  15. 15 MLT July 15, 2008 at 10:29 pm

    I prefer a much quicker route.

    1. Download .NET Fx 2.0 Redist and right-click Extract here.
    2. run “netfx.msi /qb ADDEPLOY=1 DD_IE501FOUND_X86.3643236F_FC70_11D3_A536_0090278A1BB8=True” from command-line.

    Done.

  16. 16 John Smyth July 16, 2008 at 3:03 pm

    DMitri

    I followed your instructions and everything went fine up to the point of running the command to install .net on the server core machine.

    I get a dialog box saying there is a problem with this Windows Installer Package ..Please refer to the setup log for more information.

    THis is the command line I was using
    C:\Windows>%SystemRoot%\system32\msiexec.exe /package “c:\downloads\NetFx20_x64\NetFx20a_x64.msi” vsextui=1

    (THe machine I am installing on is x64)

    Any clues on what might be stoppig the install ?

  17. 17 dmitrysotnikov July 17, 2008 at 1:21 pm

    John,

    Are you sure you saved the changes to the msi file (and not as another tranform)?

    Also, make sure that you change the conditions in BOTH:

    Regtlib.exe_Tool_____X86.3643236F_FC70_11D3_A536_0090278A1BB8
    AND
    Regtlib.exe_Tool_____A64.3643236F_FC70_11D3_A536_0090278A1BB8

    Finally, you can try the alternative posted by MLT just above your comment.

    Dmitry

  18. 18 dmitrysotnikov July 17, 2008 at 1:21 pm

    MLT, wow! Looks like an easier alternative. Learning something new every day!

  19. 19 MLT July 17, 2008 at 2:37 pm

    Couple things to consider.
    1. Config hierarchy not quite there. I had to add an EXE config to the console app I ran and include a section. Apparently no where up the chain did it exist. Not surprising.
    2. I tested this on a 32-bit install, not 64-bit. I will try that later when I setup the real box.
    3. I am sure the eventual official install will rip out things I have yet to find that may fail, but all the basics work great.

  20. 20 Rob D. July 20, 2008 at 11:51 pm

    So the reason this was left out was to reduce the footprint, attack surface, patch surface. Plus you can enable WinRM and WinRS to run PS commands and scripts from a remote system, or just target the remote system in the PS command to begin with.

    So why bother?

  21. 21 dmitrysotnikov July 21, 2008 at 7:25 am

    Rob,

    > So the reason this was left out was to reduce the footprint, attack surface, patch surface.

    Yes and no. This is a matter of choice and to some admins PowerShell can be a great additional feature of server core improving its manageability.

    With that said, the current way of installing it, described above, is for labs, rather than for production environment. Supported production procedure is coming from Microsoft and will address patching, etc.

    > Plus you can enable WinRM and WinRS to run PS commands and scripts from a remote system, or just target the remote system in the PS command to begin with.

    Not really. PowerShell v2 remoting requires not just WinRM, but also PowerShell v2 on BOTH ends. Without it, all you can do is basically WMI calls – a tiny subset of the functionality. QAD cmdlets also work remotely for Server Core DCs. And that is probably it.

    Dmitry

  22. 22 Jo February 20, 2009 at 1:40 am

    I follow all your steps and everything has worked up to the point where i try to install powershell, when i try to install it it just gives me an access denied…
    Any suggestions?

  23. 23 Dmitry Sotnikov February 20, 2009 at 1:58 pm

    Access denied on Step 3? When running the msi on the server core? Can you make sure you are local administrator on the system?

  24. 24 Jo February 20, 2009 at 4:57 pm

    Im logged in as administrator so i dont expect permissions problems, i was running the msi from an external drive so i decided to copy the msi to the c:\ drive but im still getting the same access denied. I downloaded powershellv2 ctp so im not sure if that has anything to do with it.

  25. 25 Isvet Laclaustra March 23, 2009 at 2:23 am

    Hey, prety good.

    Server Core is on FIRE! Important once we go live with .NET all patch work is on us like you said to Don, but I think it pays to have the BOX more manageable.

    Thanks for the treat, also thanks to MAX Trinidad, Compatriota Puertorriqueno, that alerted on saving a good 15 minutes of trouble shooting on the Step By Step process of ORCAS…

    Goodthings,

    Isvet

  26. 26 Shane May 4, 2009 at 2:48 pm

    BACS can run, the gui, on Hyper-V server now that 2.0 can be installed. I’ve tested it and everything works flawless. VLAN, Offloading, and teaming (with the latest drivers for your card) are easily setup now.

  27. 27 Roman June 5, 2009 at 3:14 pm

    Dmitriy, well spoken. Awesome hack.
    PS: i wrote that comment in Russian and it was getting discarded. 😦

  28. 28 Dmitry Sotnikov June 5, 2009 at 6:36 pm

    Roman,

    Thanks!

    Dmitry

    P.S. Don’t know why wordpress was discarding the Russian comment. Some weird antispam algorithm kicking in, I guess.

  29. 29 Mike July 10, 2009 at 2:21 pm

    The solution doesn’t work on Windows 2008 Core with SP2 (I am unable to install .net Framework SP2 – following your article)

    • 30 Dmitry Sotnikov July 13, 2009 at 9:20 am

      Mike,

      That’s a pity. I obviously did everything long before the SP. I don’t have the lab to re-work the whole procedure again, but my gut feeling is that the issue is probably not with the Server SP, but probably with the change of the condition test in .NET setup. If you have time, I would recommend checking various conditions in there and disabling them.

      Dmitry

  30. 31 antexyplaycle November 30, 2009 at 3:20 pm

    Fantastic, I didn’t know about this topic up to now. Thanx!

  31. 32 Steve May 20, 2010 at 10:32 pm

    If you are trying to do this on Windows Server Core R2, see this:
    http://support.microsoft.com/kb/976736

    In particular, method 1 worked for me:

    Run SCONFIG.
    Select option 4 (Configure Remote Management).
    Select option 2 (Enable Windows PowerShell).
    Click OK.

    • 33 Dmitry Sotnikov May 21, 2010 at 4:54 am

      Steve,

      This post was back from early 2008. 🙂 So all the instructions apply to Server 2008 – not R2 which indeed has native support.

      I think I need to update it with the link you posted so people do not get confused. Thanks for the reminder!

      Dmitry

  32. 35 matt laclear August 2, 2011 at 6:14 am

    Right on!

  33. 36 Ozgur_Cebi August 21, 2011 at 2:48 pm

    Awesome,
    Thanks Dmitry.

  34. 37 Andrew November 19, 2011 at 5:33 pm

    I found this, working on something for school; it doesn’t unpack the files for the .Net Framework (2.0, 3.0 or 3.5). Yes, I put all the downloads in the correct folder and run the deploy.com script from there, but still nothing.

    Anderw

    • 38 Dmitry Sotnikov November 20, 2011 at 10:03 pm

      I have not been doing this for a while now that Windows Server 2008 R2 supports PowerShell on core natively. So yes if Microsoft changed some of the packages since then, I guess you need to find how to get the files from the new ones. Please post back the info if you manage to find the new way. Or switch to R2.

      • 39 insomnia June 7, 2013 at 3:58 pm

        All you are doing is just copying the work of someone else (Artem Pronichkin) which is originally written in Russian and translating it to English and grabbing attention. Since this post is in English, this post has gotten more attention than the Russian one which is not that understandable by everyone.

        See link: http://pronichkin.com/Lists/Posts/Post.aspx?ID=69
        If you Ctrl-C, Ctrl-V the original post section by section in Google Translate, anyone will see that you have done zero effort on this other than that of the job of a translator. I know you have given the name of the original author in this post, but it is sad to see most of the credit goes to u, not to the original person who actually made the effort to make this possible.
        In the acknowledgements: you actually said that Artem Pronichkin helped you, but that is not correct. You just actually stole his work and then translated it and made it a post of your own which is too smart, but he deserves much more than this…

        I believe, whatever you are claiming you have done, anyone can do it since Google Translator can translate any language to English….LOL

  35. 41 estrela December 7, 2016 at 12:08 pm

    Can’t find PowerShell v2 CTP2 to download. I need it for Windows 2008 Server Core.


  1. 1 PowerShell on Server Core - Rod Trent at myITforum.com Trackback on May 16, 2008 at 5:34 pm
  2. 2 markwilson.it » PowerShell running on server core Trackback on May 16, 2008 at 9:40 pm
  3. 3 Tim Anderson’s ITWriting - Tech writing blog » Installing .NET, PowerShell on Windows 2008 Server Core: it can be done Trackback on May 17, 2008 at 9:16 am
  4. 4 Vlad Mazek - Vladville Blog » Blog Archive » PowerShell to the Core (2008) Trackback on May 18, 2008 at 11:23 am
  5. 5 PowerShell on Server Core « Dmitry’s PowerBlog: PowerShell and beyond - Kurbli Trackback on May 18, 2008 at 1:21 pm
  6. 6 TechNet Team Blog Austria : PowerShell auf Windows Server 2008 Server Core Trackback on May 18, 2008 at 8:16 pm
  7. 7 PowerScripting Podcast - Episode 26 « PowerScripting Podcast Trackback on May 19, 2008 at 2:02 am
  8. 8 Gaidar Magdanurov : PowerShell на Windows Server 2008 Server Core Trackback on May 19, 2008 at 6:48 am
  9. 9 The things that are better left unspoken : Looking for .Net and Powershell on Server Core? Trackback on May 19, 2008 at 7:14 am
  10. 10 Expert Texture » .NET on Server Core Trackback on May 19, 2008 at 2:22 pm
  11. 11 Instalar Powershell en Windows 2008 Server Core - Eladio Rincón, SQL Server MVP Trackback on May 19, 2008 at 3:34 pm
  12. 12 Schweizer IT Professional und TechNet Blog : PowerShell auf Server Core: unmöglich! Oder doch nicht? Trackback on May 19, 2008 at 7:00 pm
  13. 13 PowerShell не стоит на месте « PowerShell и другие скрипты Trackback on May 20, 2008 at 4:52 pm
  14. 14 PowerShell on Windows Server 2008 Core Edition - Network Administrator Knowledgebase Trackback on May 21, 2008 at 2:45 am
  15. 15 » Blog Archive » PowerShell on Server Core Trackback on May 22, 2008 at 11:35 am
  16. 16 Running Powershell On Windows Server 2008 Core « the back room tech Trackback on May 22, 2008 at 5:31 pm
  17. 17 Блог Гайдара Магдануров : PowerShell на Windows Server 2008 Server Core Trackback on June 2, 2008 at 3:06 pm
  18. 18 Power Shell on Windows Server 2008 Core!!! | Far beyond the world Trackback on June 7, 2008 at 11:28 pm
  19. 19 Robert McLaws: Windows Vista Edition : Windows PowerShell (and .NET) on Windows Server 2008 Core Trackback on June 12, 2008 at 3:17 pm
  20. 20 Набор отверток для Windows Server 2008 Core | AboutDigital Trackback on June 12, 2008 at 4:27 pm
  21. 21 Live PowerShell with Karl Prosser (Mirror) » Blog Archive » Portable PowerShell - v1 and v2 side by side - even on Server Core. Trackback on June 18, 2008 at 4:45 am
  22. 22 Live PowerShell With Karl Prosser » Blog Archive » Portable PowerShell - v1 and v2 side by side - even on Server Core. Trackback on June 18, 2008 at 4:47 am
  23. 23 Running portable PowerShell V1 and V2 side by side on Server Core » D' Technology Weblog: Technology, Blogging, Tips, Tricks, Computer, Hardware, Software, Tutorials, Internet, Web, Gadgets, Fashion, LifeStyle, Entertainment, News and more by Deepak Trackback on June 19, 2008 at 8:15 am
  24. 24 PowerShell running on server core - Mark's Windows Server Blog Trackback on July 31, 2008 at 9:18 am
  25. 25 MyOmniSite.com » Blog Archive » Windows Powershell on Server 2008 core? Trackback on September 26, 2008 at 12:28 pm
  26. 26 Open a Socket! » Should all my DCs run on Server Core? Trackback on October 27, 2008 at 11:06 pm
  27. 27 The things that are better left unspoken : An early look at new features in Server Core Trackback on November 14, 2008 at 6:42 pm
  28. 28 ServerCore بقي بيدعم PowerShell « The Arabian PowerShell Trackback on December 21, 2008 at 1:12 am
  29. 29 New Forest on Server 2008 Core « Jeffery Land’s Tech Blog Trackback on March 19, 2009 at 12:24 am
  30. 30 My Life as a Softie : Managed Code in 2008 Core Trackback on April 2, 2009 at 7:12 pm
  31. 31 The PowerShell resource | 化茧成蝶 Trackback on December 16, 2009 at 5:35 am
  32. 32 4sysops - FREE: Core Configurator 2.0 – Powerful GUI for Windows Server R2 Server Core Trackback on December 24, 2009 at 12:27 am
  33. 33 The Social Media Traffic Generation Trackback on August 26, 2010 at 9:08 pm
  34. 34 Powershell su 2008 Server Core Trackback on September 15, 2010 at 10:13 am
  35. 35 Установка и настройка типовых сервисов IIS под Windows Server 2008 R2 Core « vozerov Trackback on December 22, 2010 at 3:25 pm
  36. 36 Установка и настройка типовых сервисов IIS под Windows Server 2008 R2 Core « Блог одного админа Trackback on December 27, 2010 at 9:08 am
  37. 37 shh Trackback on May 7, 2012 at 2:59 am

Leave a comment




Legal

The posts on this blog are provided “as is” with no warranties and confer no rights. The opinions expressed on this site are mine and mine alone, and do not necessarily represent those of my employer - WSO2 or anyone else for that matter. All trademarks acknowledged.

© 2007-2014 Dmitry Sotnikov

May 2008
M T W T F S S
 1234
567891011
12131415161718
19202122232425
262728293031