I have a web application, which I publish to three web servers using the 'publish' option.

I want to encrypt the connectionstrings section of the web config file. The command below will do it:

c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -pef "connectionStrings" c:\inetpub\application

However, I have to RDP (Remote Desktop) to each server and run the command on each server as you cannot run it like this (from a client PC):

\servername\c$\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -pef "connectionStrings" \servername\c$\inetpub\application

Is there a better way of doing this: perhaps:

1) Execute a command line on the server after publishing 2) Use a build option in Visual Studio that allows you to execute a batch file after publishing is complete

Edit
Report