write-host

by Jul 25, 2013

Hi I'm using the following script

$a = Get-Content "c:servers.txt"

foreach ($i in $a) 

{$files= get-content "c:test.txt"

foreach ($file in $files)

{Copy-Item $file -Destination \$iC$ -force}}

 

to copy files to hosts in the servers .txt file.  How do I get the script to write out the host or hosts it could not write to?

 

Many thanks