【问题标题】:Unable to copy a binary to a remote Azure VM无法将二进制文件复制到远程 Azure VM
【发布时间】:2019-09-09 03:13:52
【问题描述】:

我有一个来自本地 (VMWare) 的 Shavlink 代理二进制文件,必须将其复制到 Azure VM。

我使用目标 Azure VM 的公共 VM 来执行复制:

Copy-Item –Path "C:\ProgramData\LANDESK\Shavlik Protect\Console\DataFiles\STPlatformUpdater.exe" –Destination "D:\Shavlik-Agent\" –ToSession (New-PSSession –ComputerName a.b.c.d)

不幸的是,它给出了如下错误:

New-PSSession : [a.b.c.d] Connecting to remote server a.b.c.d. failed with the following error message : The WinRM client cannot process the request. Default
authentication may be used with an IP address under the following conditions: the transport is HTTPS or the destination is in the TrustedHosts list, and explicit
credentials are provided. Use winrm.cmd to configure TrustedHosts. Note that computers in the TrustedHosts list might not be authenticated. For more information on how to
set TrustedHosts run the following command: winrm help config. For more information, see the about_Remote_Troubleshooting Help topic.
At line:1 char:143
+ ... avlik-Agent\" –ToSession (New-PSSession –ComputerName a.b.c.d.)
+                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemotingTransportException
    + FullyQualifiedErrorId : CannotUseIPAddress,PSSessionOpenFailed
Copy-Item : Cannot validate argument on parameter 'ToSession'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again
At line:1 char:142
+ ... avlik-Agent\" –ToSession (New-PSSession –ComputerName a.b.c.d+                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Copy-Item], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.PowerShell.Commands.CopyItemCommand

在远程机器上,我启用了端口 59855986 想知道我需要做什么才能使其正常工作?

【问题讨论】:

    标签: azure-virtual-machine powershell-remoting powershell-5.0


    【解决方案1】:

    您需要配置您的 winrm 以信任远程机器,最简单的方法如下:

    Set-Item WSMan:\localhost\Client\TrustedHosts -Value "a.b.c.d"
    

    阅读:https://docs.microsoft.com/en-us/windows/win32/winrm/installation-and-configuration-for-windows-remote-management

    【讨论】:

      猜你喜欢
      • 2017-09-06
      • 2021-09-10
      • 2016-09-25
      • 1970-01-01
      • 2020-08-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-05-09
      相关资源
      最近更新 更多