Questo sembra funzionare come in PowerShell v3. Non ho a portata di mano la v2, ma ci sono due opzioni di cui sono a conoscenza, che dovrebbero funzionare. In primo luogo, si potrebbe mappare 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
Se questo è qualcosa che si sta andando a fare molto, si potrebbe anche avvolgere questo in una funzione:
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
}
In alternativa, è possibile specificare in modo esplicito il provider con ogni percorso:
Copy-Item -Path "Microsoft.PowerShell.Core\FileSystem::\\machine1\abc\123\log 1.zip" -Destination "Microsoft.PowerShell.Core\FileSystem::\\machine2\\c$\Logs\"
Se si esegue 'Get-ChildItem -Path" \\ machine1 \ abc \ 123 "' viene visualizzata una voce per 'log 1.zip' o viene visualizzato un errore? Inoltre, 'log 1.zip' è un file nascosto? – BACON