In this post I will take you through step-by-step how to install Windows PowerShell onto a Windows Server 2008 R2 Core edition instance. I will also add an optional element of making PowerShell your default shell for when you log in.
- First we will install .Net Framework 2 or above, Windows PowerShell, and Server Manager Cmdlets
start /w ocsetup NetFx2-ServerCore start /w ocsetup MicrosoftWindowsPowerShell start /w ocsetup ServerManager-PSH-Cmdlets
- 2.Reboot your server and then try powershell.exe at the command line will ensure it is installed onto your system. To run PowerShell now you can just type “PowerShell” .
- Optional: You can optionally set PowerShell to be your default shell instead of cmd. This can be done in two way: By opening RegEdit and editing a setting or you can set the registry setting via PowerShell by navigating to “CD HKLM:”. Below I will paste the code snippet for editing through PowerShell and a screen shot showing where to edit i RegEdit. The path for RegEdit can be determined by the code snippet.
Set-ItemProperty "HKLM:SoftwareMicrosoftWindows NTCurrentVersionWinLogon" Shell "PowerShell.exe"
- Now when you log onto this machine PowerShell will be your default Shell. To make this more useful in the setup stages I always like to add a bit more to the code so it will load the Server Manager Cmdlets, which helps manage Roles and Features.
Set-ItemProperty "HKLM:SoftwareMicrosoftWindows NTCurrentVersionWinLogon" Shell ‘PowerShell.exe –noexit –command "Import-Module ServerManager"’