我正在努力
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
存在。我为此发疯了。
我能做什么来修复它?