Set-ExecutionPolicy -ExecutionPolicy Bypass
$webServers = "remoteservername1"
$deploymentCredentials = Get-Credential
Invoke-Command -ComputerName $webServers -Credential $deploymentCredentials -ScriptBlock {
$appVersionDirectory = "C:\Test"
The New-Item creates the directory without a problem:
New-Item -ItemType directory -Path $appVersionDirectory
The Copy-Item does not error, but will not copy any files
If I run this same Copy-Item command directly on the remote server, it works!
$sourceFiles = "\\sourceserver\DeploymentSource\shared\*"
Copy-Item $sourceFiles -Destination $appVersionDirectory
}