
[英]Unable to run remote powershell script which is located in remote Azure VM D: drive using Invoke-Command
[英]Unable to copy a binary to a remote Azure VM
我有一个来自本地(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
在远程计算机上,我启用了端口5985和5986,想知道要使其正常工作需要做什么?
您需要将Winrm配置为信任远程计算机,最简单的方法如下:
Set-Item WSMan:\localhost\Client\TrustedHosts -Value "a.b.c.d"
阅读: https : //docs.microsoft.com/zh-cn/windows/win32/winrm/installation-and-configuration-for-windows-remote-management
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.