正在Powershell中从远程服务器检索文件
是否有任何方法可以调用命令,获取远程服务器上的文件内容,然后将内容写入本地计算机上的文件 希望能有这样的结果:正在Powershell中从远程服务器检索文件,powershell,Powershell,是否有任何方法可以调用命令,获取远程服务器上的文件内容,然后将内容写入本地计算机上的文件 希望能有这样的结果: Invoke-Command -ComputerName ###.##.###.## { $file= Get-Content C:\Windows\System32\drivers\etc\hosts } -Credential $cred $file | Out-File \\path\to\local\machine 你就快到了 $file = Invoke-Command -
Invoke-Command -ComputerName ###.##.###.## { $file= Get-Content C:\Windows\System32\drivers\etc\hosts } -Credential $cred
$file | Out-File \\path\to\local\machine
你就快到了
$file = Invoke-Command -ComputerName ###.##.###.## { Get-Content C:\Windows\System32\drivers\etc\hosts } -Credential $cred
$file | Out-File \\path\to\local\machine
为什么不将复制项与-FromSession参数一起使用??
我知道您需要先打开会话,但我认为保存一些特殊文件更方便。如果我使用
-AsJob
标志怎么办?如何访问Get Content
的结果,而不是-AsJob
返回的内容?