Wydaje się działać tak, jak w PowerShell v3. Nie mam v2 przydatnego do przetestowania, ale są dwie opcje, o których jestem świadomy, które powinny działać. Po pierwsze, można map PSDrives:
New-PSDrive -Name source -PSProvider FileSystem -Root \\machine1\abc\123 | Out-Null
New-PSDrive -Name target -PSProvider FileSystem -Root \\machine2\c$\Logs | Out-Null
Copy-Item -Path source:\log_1.zip -Destination target:
Remove-PSDrive source
Remove-PSDrive target
Jeśli jest coś, co zamierzamy zrobić dużo, można nawet owinąć to w funkcję:
Function Copy-ItemUNC($SourcePath, $TargetPath, $FileName)
{
New-PSDrive -Name source -PSProvider FileSystem -Root $SourcePath | Out-Null
New-PSDrive -Name target -PSProvider FileSystem -Root $TargetPath | Out-Null
Copy-Item -Path source:\$FileName -Destination target:
Remove-PSDrive source
Remove-PSDrive target
}
Alternatywnie, można jednoznacznie określić dostawcy z każdej ścieżki:
Copy-Item -Path "Microsoft.PowerShell.Core\FileSystem::\\machine1\abc\123\log 1.zip" -Destination "Microsoft.PowerShell.Core\FileSystem::\\machine2\\c$\Logs\"
Jeśli uruchomisz 'Get-ChildItem -Path" \\ machine1 \ abc \ 123 "' czy wyświetla pozycję dla 'log 1.zip' lub czy wyświetla błąd? Czy jest też ukryty plik 'log 1.zip'? – BACON