【问题标题】:How to transfer files (folders) from one server to another with PowerShell?如何使用 PowerShell 将文件(文件夹)从一台服务器传输到另一台服务器?
【发布时间】:2018-12-11 19:10:48
【问题描述】:

我刚开始使用 PowerShell,我想知道如何在本地服务器和远程服务器之间传输文件。 目前我没有对任一服务器的管理员访问权限(我知道我将需要它),我如何定位 Get cmdlt?我使用 URL 吗?

【问题讨论】:

  • 在发布此问题之前,您是否阅读过其他与SO 相关的问题?请参阅How to Ask 链接以获取有关如何提出问题并相应更新您的问题的更多详细信息。

标签: powershell file server file-transfer transfer


【解决方案1】:

了解该主题的速度至关重要。花点时间跳到MS Virtual academyMS Channel9
YouTube 并参加有关该主题的快速培训课程。

它们以及 PowerShell 帮助文件中都涵盖了您所要求的内容,其中包括有关如何执行此操作的示例。

# get function / cmdlet details
(Get-Command -Name Copy-Item).Parameters
Get-help -Name Copy-Item -Full
Get-help -Name Copy-Item -Online
Get-help -Name Copy-Item -Examples

名称 复制项目 概要 将项目从一个位置复制到另一个位置。

Example 1: Copy a file to the specified directory

PS C:\>Copy-Item "C:\Wabash\Logfiles\mar1604.log.txt" -Destination "C:\Presentation"

This command copies the mar1604.log.txt file to the C:\Presentation directory. The command does not delete the original

文件。 示例2:将一个目录的内容复制到另一个目录

PS C:\>Copy-Item "C:\Logfiles" -Destination "C:\Drawings" -Recurse

This command copies the entire contents of the Logfiles directory into the Drawings directory. If the LogFiles directory contains files

在 子目录,这些子目录将被完整地复制其文件树。 Container 参数默认设置为 true。 这保留了

# Get parameter that accepts pipeline input
Get-Help Copy-Item -Parameter * | 
Where-Object {$_.pipelineInput -match 'true'} | 
Select * 


# Get cmdlet / function parameter aliases
(Get-Command Copy-Item).Parameters.Values | 
where aliases | 
select Name, Aliases | Out-GridView -PassThru -Title 'Alias results for a given cmdlet or function.'

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-01-23
    • 2018-09-14
    • 2011-11-05
    • 1970-01-01
    • 2021-12-25
    • 1970-01-01
    相关资源
    最近更新 更多