Using Powershell to remotely configure servers: Part I

Powershell has been around for a while now, and has gradually improved in functionality with each new release.  Powershell in a nutshell is an answer to the shells on other operating systems, and provides a variety of unique functionality on top of it.

One of the most beneficial features has been the ability to create remote sessions to configure servers.  Microsoft has implemented this through WinRM/WinRS which is grounded in the WS-Management and CIM standards.  If WinRM is configured on a machine and remote shells are enabled, it’s fairly simple to do this. In this post, I’ll just show how to set it up.   You do not need to do this if you just plan on connecting to remote computers. Additionally, some newer versions of Windows / Server have this enabled by default now.

Open up a powershell prompt as an administrator on the PC / Server that you would like to remotely manage.  After you’ve done this simply run the command:

Enable-PSRemoting

You will likely get a series of questions stating some of the various actions that are being taken to enable remoting and requesting you to allow them to happen.  Once the cmdlet is done, you’ll be able to connect with Powershell sessions to the computer if it’s trusted by the client.  If you would like to ignore all the prompts, use the “-Force” parameter to automatically accept any of them.  If it’s already set up, the cmdlet will simply fail and do nothing.  On some operating system versions, remoting is enabled by default.

If you’d like more help with the Enable-PSRemoting command simply type “Get-Help Enable-PSRemoting”.

See the samples at my BitBucket repository
WinRM Setup Samples

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s