gpt4 book ai didi

powershell - 使用凭据将文件复制到远程服务器的 PowerShell 命令出错

转载 作者:行者123 更新时间:2023-12-04 01:52:32 30 4
gpt4 key购买 nike

PS C:\Windows\system32> Copy-Item -ToSession $s C:\Programs\temp\test.txt -Destination C:\Programs\temp\test.txt

Copy-Item : A parameter cannot be found that matches parameter name 'ToSession'. At line:1 char:11

  • Copy-Item -ToSession $s C:\Programs\temp\test.txt -Destination C:\Programs\temp\ ...
  • ~~~~~~~~~~
    • CategoryInfo : InvalidArgument: (:) [Copy-Item], ParameterBindingException
    • FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.CopyItemCommand

最佳答案

正如 PoSh V5 的更改列表中所述 here并且您用 V4 标记了您的问题 简单的答案可能是您的版本的 Copy-Item cmdlet 不提供该参数

Copy-Item now lets you copy files or folders from one Windows PowerShell session to another, meaning that you can copy files to sessions that are connected to remote computers, (including computers that are running Nano Server, and thus have no other interface). To copy files, specify PSSession IDs as the value of the new -FromSession and -ToSession parameters, and add –Path and –Destination to specify origin path and destination, respectively. For example, Copy-Item -Path c:\myFile.txt -ToSession $s -Destination d:\destinationFolder.

关于powershell - 使用凭据将文件复制到远程服务器的 PowerShell 命令出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39224609/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com