I am trying to copy content of a folder, but there are two files which I would like to exclude. The rest of all the content should be copied to a new location and existing content on that new location should be overwritten.
This is my script. It works fine if my destination folder is empty, but if I have files and folder, it doesn't overwrite them.
$copyAdmin = $unzipAdmin + "/Content/*"
$exclude = @('Web.config','Deploy')
Copy-Item -Path $copyAdmin -Destination $AdminPath -Exclude $exclude -Recurse -force
$AdminPath
defined correctly in your script? – Raf