Wednesday, March 21, 2012

Enable PowerShell Remoting

PowerShell 2.0 introduces PowerShell remoting. PowerShell remoting allows you to run cmdlets or scripts on a remote server. For example, you can have one central server that hosts scripts. From the console of that server, you can then run the locally stored script on multiple servers.

In the words of the man who taught me that instructors don't need to read from a book (Bob Vergidis): What does this buy me?

Using PowerShell remoting buys you:
  • The ability to centralize maintenance of your scripts
  • A central location to schedule scripts to run as tasks
  • The ability to create a script that performs actions on multiple servers even if the cmdlets do not have an option to specify a remote computer
In order to use PowerShell remoting, three things need to be in place:
  1. Configure the WinRM service to create a listener
  2. Make sure that the WinRM starts automatically
  3. Configure the firewall to allow communication with WinRM (port 5985)
The easiest way to enable PowerShell remoting on a specific computer is to run the PowerShell cmdlet:
Enable-PSRemoting

In small environments with only a few servers, manually enabling PowerShell remoting one-by-one works well. It takes only a few seconds per server. In larger environments, you will probably want to use Group Policy to push out the necessary configuration changes. This document describes how to create a GPO that enables PowerShell remoting:

No comments:

Post a Comment