Afternoon,
I am attempting to copy a set of files to multiple computers on the network (files are at a dfs link, no issue there).
The destination path on each computer is either:
"\\$computer\c$\Program Files\AASHTOWare\Trnsport Client-Server PES-LAS" OR \\$computer\c$\Program Files (x86)\AASHTOWare\Trnsport Client-Server PES-LAS"
The paths both have a "." in them. It is called a "middle dot" I think. It is centered between the two wordsin the path...When I run test-path it can see the path. However when I attempt to copy files to it, I get the "illegal characters in path" error.
Below is the script I am working to get right, I hope)..
$file = "\\path\to\files\ITClientBuild\Specs2\specslas5\testcopy.txt" $outfile = "c:\temp\las6copy.csv" gc c:\temp\las6.txt | %{ $computer = $_ $ping = Test-Connection $computer -Count 2 -Quiet if ($ping) { $pathTest1 = Test-Path "\\$computer\c$\Program Files\AASHTOWare\Trnsport Client-Server PES-LAS" $pathTest2 = Test-Path "\\$computer\c$\Program Files (x86)\AASHTOWare\Trnsport Client-Server PES-LAS" if($pathTest1 -eq $true){ # md -Force "\\$computer\c$\windows\temp\las5a" # cp -force "\\$computer\c$\Program Files\AASHTOWare\Trnsport Client-Server PES-LAS\las6cust.pbd" "\\$computer\c$\windows\temp\las5\*" cp -force $file "\\$computer\\c$\\Program Files\\AASHTOWare\\Trnsport Client-Server PES-LAS\\*" "$computer FILE PUSHED to PES-LAS dir" >> $outfile } else {"$computer las6 PATH DOES NOT EXIST!!" >> $outfile } if ($pathTest2 -eq $true){ # md -Force "\\$computer\c$\windows\temp\las5a" # cp -force "\\$computer\c$\Program Files (x86)\AASHTOWare\Trnsport Client-Server PES-LAS\las6cust.pbd" "\\$computer\c$\windows\temp\las5\*" cp -force $file "\\$computer\c$\Program Files (x86)\AASHTOWare\Trnsport Client-Server PES-LAS\*" "$computer FILE PUSHED to PES-LAS dir" >> $outfile } else {"$computer PES-LAS PATH DOES NOT EXIST!!" >> $outfile } } else {"$computer OFFLINE" >> $outfile } }
My end need is to:
Create a folder on the destination workstations, copy the original file(s) to that folder, copy the newer file(s) to the paths indicated..I have had no issues previously with copying files via powershell. However this is my first time running up against this issue.
Your assistance is greatly appreciated...(Note: I am fairly new at this...but learning all the time)
Tony.
- Moved by Bill_Stewart Wednesday, July 09, 2014 2:18 PM Abandoned drive-by question