Copy Files to SharePoint Servers Remotely using PowerShell

During a branding project, We had to deploy a logo file every time to all SharePoint servers by individually logging in to them and copy pasting given file to all SharePoint 2013 server’s 15 hive. Wanted to do a bit automation with PowerShell here. Let the PowerShell do Copy-Paste for us.

PowerShell script to copy files to Servers Remotely:

$LogoPath = "D:\Branding\crescent-logo.png" 

#Define Array with List of servers
$WFEServers = ("G1V-SPS13001", "G1V-SPS13002", "G1V-SPS13003", "G1V-SPS13004", "G1V-SPS13005")

foreach ($Server in $WFEServers)
      #Destination path
      $Destination = "\\$Server\C$\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\IMAGES\crescent-logo.png"

      #Copy File from local to destination
      Copy-Item $LogoPath $Destination

      write-host "Copied to Server:"$Server

You can run this script from your workstation. Just make sure the account in which you are running this script has Admin access on all of the servers listed.

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two-decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. He has held various positions including SharePoint Architect, Administrator, Developer and consultant, has helped many organizations to implement and optimize SharePoint solutions. Known for his deep technical expertise, He's passionate about sharing the knowledge and insights to help others, through the real-world articles!

Leave a Reply

Your email address will not be published. Required fields are marked *