MWJ Computing A life lived through digital exploration.

1Feb/100

An introduction to PowerShell remoting – Part 2

This is part two in a series on PowerShell remoting. You can read part one here. Today we are going to cover setting up your environment for remoting.

Setting up remoting

After you have installed the required goodies or have Windows 7 / Windows 2008 R2 installed, you can proceed to setup remoting.

The command to enable remoting is Enable-PSRemoting. You will need to run this command with an account that has admin privileges on the machine you are enabling this on. As you can see below, running the Enable-PSRemoting command lets you know what the cmdlet will change on your PC. If you work in an environment that has system baselines, you will want to update your baseline to include the information for PSRemoting.

enable-psremoting

On PC’s that are x64, you will get an additional question asking if it should register the Microsoft.PowerShell32 session configuration.  The entire chain of questions is below.

enable-psremoting-w64

According to the Technet Article on Enable-PSRemoting, the following things are done when the command is run. (Enable-PSRemoting on Technet)

The Enable-PSRemoting cmdlet performs the following operations:

  • Runs the Set-WSManQuickConfig cmdlet, which performs the following tasks:
    • Starts the WinRM service.
    • Sets the startup type on the WinRM service to Automatic.
    • Creates a listener to accept requests on any IP address.
    • Enables a firewall exception for WS-Management communications.
  • Enables all registered Windows PowerShell session configurations to receive instructions from a remote computer.
    • Registers the "Microsoft.PowerShell" session configuration, if it is not already registered.
    • Registers the "Microsoft.PowerShell32" session configuration on 64-bit computers, if it is not already registered.
    • Removes the "Deny Everyone" setting from the security descriptor for all the registered session configurations.
    • Restarts the WinRM service to make the preceding changes effective.

The following is a screenshot of the firewall exception for the WS-Management communications.

wsman-firewall-rule
To view the plugins that were added two WSMan, run the following command:

Get-ChildItem wsman:\localhost\plugin

The results on a fresh Windows Server 2008 R2 machine is below. Notice the two entries for PowerShell.

wsman-plugins

Note: We will go over WSMan on a separate post in this series. 

Remoting is now turned on!

What do you do now? Well you have a couple of options. First you could run commands against that machine using PowerShell on another PC or you can adjust the configuration. In the next post, we will go over the configuration and running commands against a remote host.

Until next time! Happy Scripting!

- Matt

Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


No trackbacks yet.