Friday, February 10, 2023

Copy file to multiple remote server using powershell

 

Share your folder where you have files. if you have multiple files or folder then you zip them. 

       Who ever Admin performing this operation or activity should have access on both source and target to copy and pate the files from a Network share folder. 


$servers = Get-Content 'c:\temp\file.txt'

Invoke-Command -ComputerName $servers -ScriptBlock

{

Copy-Item -Path '\\servername\folder\file.zip' -Destination "c:\\temp" -Verbose

}