Solved

powershell Use to copy file and replace to multiple servers

Posted on 2012-03-21
1
581 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 500 total points
Comment Utility
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

How to sign a powershell script so you can prevent tampering, and only allow users to run authorised Powershell scripts
In this previous article (https://oddytee.wordpress.com/2016/05/05/provision-new-office-365-user-and-mailbox-from-exchange-hybrid-via-powershell/), we made basic license assignments to users in O365. When I say basic, the method is the simplest way …
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now