Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

write-host

$
0
0

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 \\$i\C$\ -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


Viewing all articles
Browse latest Browse all 6937

Trending Articles