Я пытаюсь заставить PowerShell копировать файлы с удаленного компьютера (на котором у меня есть права администратора). права через AD) на локальный компьютер. Не получается в самом странном месте. Вот фрагмент сценария:
$configs = Get-ChildItem -Recurse -ErrorAction SilentlyContinue -Filter "*.config" $serverUNCPath
foreach($config in $configs){
$config_target_dir = $dest.Path + $config.Directory.FullName.Replace($serverUNCPath,"")
if(Test-Path -Path $config_target_dir){
Copy-Item $config -Destination $config_target_dir
}
}
Это не удается с сообщением
Cannot find path 'D:\ServerDeploy\TestMachine1\website\web.config' because it does not exist.
At :line:39 char:12
+ Copy-Item <<<< $config -Destination $config_target_dir
Путь D:\ServerDeploy\TestMachine1\website
существует. Я схожу с ума по этому поводу.
Что я могу сделать, чтобы это исправить?