Copy files to every server (SharePoint)

Even with the ‘new era’ being Office 365, sometimes (!) we have to deal with an on-premises SharePoint farm – often with many servers.

The recent environment I was upgrading has over a dozen servers – and we had a need to copy a file to EVERY server.

This was simply a PDF icon image – but a pain-in-the-butt to copy to lots of locations.

The solution was to define an XML file with a list of servers, and some PowerShell to do the copying.

Make sure to save both files to the same folder – and the image file (in this situation).








The PowerShell script does the following :

  • Open the XML file
  • Do a “Foreach” for the servers
  • Define the path for the file (destination)
  • Do a “Copy-Item” command – to each \SERVERC$path


$xml = [xml] (Get-Content (resolve-path .SERVERS_LIST.xml))

$currentPath = (resolve-path .pdficon_small.png)

$servers = $xml.Servers.Server

$servers | % {

      $server = $_

      $path = “\$serverC$Program FilesCommon Filesmicrosoft sharedWeb Server Extensions15TEMPLATEIMAGESicpdf.png”

      Copy-Item $currentPath $path



This is a great option for a quick “deploy to every server” – as a scripted solution.

Hope this can be helpful / useful for your environment !


Leave a Reply

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

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

Google photo

You are commenting using your Google 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 )

Connecting to %s