Here is what I have so far. I get the message
Copy-Item : Illegal characters in path.
I am trying to create a directory on each workstation (`89), copy an existing file on the workstation(s) to that folder, then copy new file(s) to the path stated. When I comment out everything to do with copying and just verify the path, the path comes back as valid.
I tried deploying these files via a s/w push in SCCM (2007) using a batch file but it failed because of a path not found/invalid path error, because of the ·
(called a middle dot) between Trns
and port
.
$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\Trns·port Client-Server PES-LAS"
$pathTest2 = Test-Path "\\$computer\c$\Program Files (x86)\AASHTOWare\Trns·port Client-Server PES-LAS"
if($pathTest1 -eq $true){
# md -Force "\\$computer\c$\windows\temp\las5a"
# cp -force "\\$computer\c$\Program Files\AASHTOWare\Trns·port Client-Server PES-LAS\las6cust.pbd" "\\$computer\c$\windows\temp\las5\*"
cp -force $file "\\$computer\\c$\\Program Files\\AASHTOWare\\Trns·port 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\Trns·port Client-Server PES-LAS\las6cust.pbd" "\\$computer\c$\windows\temp\las5\*"
cp -force $file "\\$computer\c$\Program Files (x86)\AASHTOWare\Trns·port 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
}
}