On a fresh install of Windows 2008 R2 there are four commands that you might want to run to get the computer prepared for developing and testing PowerShell scripts. This blog post tells you what these four commands are and how to execute them.
Step 0: Run PowerShell As Administrator
Since the following commands will require administrator privileges start the PowerShell console as Administrator. Right click on the PowerShell icon on the taskbar and choose the Run As Administrator command.
Figure 1: Run PowerShell console as Administrator
Step 1: Enable execution of un-signed local scripts
Now type Set-ExecutionPolicy remotesigned to enable the execution of un-singed scripts that didn’t get downloaded via Internet Explorer or Outlook. Confirm with y for yes.
Step 2: Enable PowerShell Remoting
Next type Enable-PSRemoting to enable PowerShell remoting. Confirm with y for yes, when being prompted.
Figure 2: Set the script execution policy and enable PowerShell Remoting
Step 3: Install the PowerShell ISE
On Windows 2008 R2 Server the PowerShell Integrated Scripting Environment ISE tool is not installed by default, but needs to be added as a Windows Feature. This is a two step process.
First import the Server Manager module that contains a cmdlet for adding Windows Features.
Type Import-Module ServerManager
Figure 3: Import the Server Manager module and install the PowerShell ISE
Once the Server Manager module has been imported successfully type:
Type Add-WindowsFeature PowerShell-ISE
Note: The minus letter instead of the underscore is not a typo.
Figure 4: The PowerShell ISE installation was successfull
Ready, Steady, Go PowerShell
Run the PowerShell ISE and start developing PowerShell scripts.
Figure 5: PowerShell ISE in action