[英]Powershell BitsTransfer from remote session
Is it possible to use PowerShell BitsTransfer to transfer files from a remote session?是否可以使用 PowerShell BitsTransfer 从远程 session 传输文件? For instance, without BitsTransfer using only Copy-Item I can do:
例如,如果没有 BitsTransfer,只使用 Copy-Item 我可以:
$session = New-PSSession -ComputerName some_server;
Copy-Item -FromSession $session -Path 'C:\RemoteDirectory\file.txt' -Destination 'C:\LocalDirectory\file.txt';
But for BitsTransfer there is no equivalent of FromSession parameter:但是对于 BitsTransfer,没有 FromSession 参数的等价物:
# Works for local files
Start-BitsTransfer -Source "C:\RemoteDirectory\file.txt" -Destination 'C:\LocalDirectory\file.txt';
I want to use BitsTransfer because it gives me a nice progress bar for larger files, and that's essentially the only reason I need it.我想使用 BitsTransfer,因为它为我提供了一个很好的大文件进度条,这基本上是我需要它的唯一原因。 Perhaps there is another way to do it altogether?
也许还有另一种方法可以完全做到这一点?
Thank you in advance for any help!预先感谢您的任何帮助!
You can use UNC
pathing to do this.您可以使用
UNC
路径来执行此操作。
Start-BitsTransfer -Source "\\server\C$\RemoteDirectory\file.txt" -Destination "C:\LocalDirectory\"
You can also use alternate credentials by using the -Credential
parameter.您还可以通过使用
-Credential
参数来使用备用凭据。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.