Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Copy-item script ... this is blowing my mind

$
0
0

all I want to do is take a folder and ALL folders and files within & copy them to a block of servers, but the following fails:

$Servers = import-csv -path "c:\WebServ.csv"
$path1 = get-item -path "$env:systemdrive\Microsoft SQL Server JDBC Driver 3.0"
$path2 = "$server\c$\Program Files\"
Start-Transcript -path "C:\Filecopy.log" -append
foreach ($server in $servers)
	{	
		copy-item -path "$path1" -destination "$path2"
	}
Stop-Transcript

The csv file has 1 column with a header, that header being "ServerName"

I don't understand the error I get:

copy-item : Item with specified name C:\c$\Program Files\Microsoft SQL Server JDBC Driver 3.0 already exists.

The folder doesn't exist at the destination.

and ...

what's the deal with the C drive being referenced twice?

I'm ready to tear my hair out :-(



Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>