Hi there,
This is my first post. Ran into a small problem I simply can't resolve. Code:
$comp = Read-Host "Enter PC-name: "
$from = "\\server01\Folder name\Versions\Script\File.exe"
$to = "\\" + $comp + "\" + "c$" + "\Folder\Folder"
if(test-path $from){
Copy-Item -path @from -destination $to -force
pause
}else{
Write-Host "No such path."
}
I get the error: Copy-Item : A positional parameter cannot be found that accepts argument '\'.
Entering the UNC path in explorer works and have the write rights. After some research I found out it might have something to do with spaces in in folder names on a unc path OR using "$c" in the path. Tried a lot but nothing works. Any ideas?