[This post was originally posted on my personal blog, http://simplystallings.com]
At work, we manually patch our web servers. Part of the process requires ftping the updates to each server. This process is tedious considering the number of web servers and number of steps required. I decided this past patch Tuesday that I would invest a little time into automating the process using powershell.
I located a simple ftp upload script located @ http://poshcode.org/1134. With a few modifications I had my script:
I added an array that contains the ftp URL syntax for each web server then I iterate over the array using a for loop.
A few notes about the script. If you plan to put passwords in the script then you should encrypt the file. Alternatively, you could have the script prompt for credentials. The script will automatically overwrite a file if the same file name exists in the remote destination. Do not use passwords with an @ character because the powershell parser will not be able to determine where the host name begins.