[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

powershell Use to copy file and replace to multiple servers

Posted on 2012-03-21
1
Medium Priority
?
618 Views
Last Modified: 2012-04-11
Hi,
I'm thinking could be possible with powershell use to copy the file and replace the file which same name in multiple servers. I'm not into really developer guy so I do not know how to construct this powershell command.
anybody volunteer for the help ?

Method: copy the file let says mon.cfg and distribute it to multiple servers where these servers has the same file name exist.
0
Comment
Question by:motioneye
1 Comment
 
LVL 6

Accepted Solution

by:
NikolasG earned 2000 total points
ID: 37746986
You could use the following
$source ="c:\test\* "
$targets = @('pc1', 'pc2', 'pc3') #target computer names
$targetfolder ='c$\'  #target path
	foreach ($cpc in $targets)
	{	
	Write-Host $i.FulName
	Write-Host "To \\"$cpc"\"$targetfolder
	$tar="\\"+$cpc+"\"+$targetfolder
	Copy-Item $source $tar
	}

Open in new window


which copies all the contents of the source folder to the target pcs

Hope it helps.
0

Featured Post

New Tabletop Appliances Blow Competitors Away!

WatchGuard’s new T15, T35 and T55 tabletop UTMs provide the highest-performing security inspection in their class, allowing users at small offices, home offices and distributed enterprises to experience blazing-fast Internet speeds without sacrificing enterprise-grade security.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Windows 10 came with  a lot of built in applications, Some organisations leave them there, some will control them using GPO's. This Article is useful for those who do not want to have any applications in their image (example:me).
In this post, I will showcase the steps for how to create groups in Office 365. Office 365 groups allow for ease of flexibility and collaboration between staff members.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Loops Section Overview

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question