2014-08-27 6 views
3

나는 확실하지 않다 제대로invoke-command가 작동하지 않는 것 같아요 - winrm.cmd를 사용하여 TrustedHosts를 올바르게 구성 했습니까? 내가하여 TrustedHosts를 구성하는 winrmcmd를 사용한 경우

내가 host_computer에서 PowerShell에서 명령을 실행하고 (작업 그룹의 일부)

$cred = Get-Credential -credential user 

프롬프트가 나타나면, 내가 암호를 입력

enter image description here

그런 다음 setup.exe가 remote_computer (작업 그룹의 일부 임)에서 실행되도록 명령을 실행합니다.

invoke-command -ComputerName remote_computer -credential $cred -scriptBlock {& 'C:\share\setup.exe'} 

오류가 나타납니다

[remote_computer] Connecting to remote server remote_computer failed with the following error message : The WinRM client cannot process the request. If the authentication scheme is different from Kerberos, or if the client 
computer is not joined to a domain, then HTTPS transport must be used or the destination machine must be added to the TrustedHosts configuration setting. Use winrm.cmd to configure TrustedHosts. Note that computers in the 
TrustedHosts list might not be authenticated. You can get more information about that by running the following command: winrm help config. For more information, see the about_Remote_Troubleshooting Help topic. 
    + CategoryInfo   : OpenError: (remote_computer:String) [], PSRemotingTransportException 
    + FullyQualifiedErrorId : ServerNotTrusted,PSSessionStateBroken 

내가 명령 프롬프트를 열고 host_computer에 http://pubs.vmware.com/orchestrator-plugins/index.jsp#com.vmware.using.powershell.plugin.doc_10/GUID-D4ACA4EF-D018-448A-866A-DECDDA5CC3C1.html

에 따라 단계를 수행합니다 (이동, "관리자로 실행"을 선택하고 마우스 오른쪽 버튼을 클릭) 다음을 실행

C:\Windows\system32>winrm quickconfig 

C:\Windows\system32>winrm e winrm/config/listener 

C:\Windows\system32>winrm get winrm/config 

C:\Windows\system32>winrm set winrm/config/service/auth @{Basic="true"} 

C:\Windows\system32>winrm set winrm/config/service @{AllowUnencrypted="true"} 

C:\Windows\system32>winrm set winrm/config/client @{TrustedHosts="remote_computer"} 

remote_computer에서 명령 프롬프트 (시프트, 오른쪽 클릭, "관리자 권한으로 실행"선택)를 열고 exec UTE

C:\Windows\system32>winrm get winrm/config 

C:\Windows\system32>winrm set winrm/config/client/auth @{Basic="true"} 

C:\Windows\system32>winrm set winrm/config/client @{AllowUnencrypted="true"} 

C:\Windows\system32>winrm set winrm/config/client @{TrustedHosts="host_computer"} 

C:\Windows\system32>winrm identify -r:http://host_computer:5985 -auth:basic -u:user -p:password -encoding:utf-8 

내가 host_computer 및

invoke-command -ComputerName remote_computer -credential $cred -scriptBlock {& 'C:\share\setup.exe'} 

내가 더 이상 오류 메시지를 얻을 실행 갈 때 나는 이제 다음과 같은 응답

IdentifyResponse 
    ProtocolVersion = http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd 
    ProductVendor = Microsoft Corporation 
    ProductVersion = OS: 6.3.9600 SP: 0.0 Stack: 3.0 
    SecurityProfiles 
     SecurityProfileName = http://schemas.dmtf.org/wbem/wsman/1/wsman/secprof 
ile/http/basic, http://schemas.dmtf.org/wbem/wsman/1/wsman/secprofile/http/spneg 
o-kerberos 

를 얻을 다음,하지만 때 원격 remote_host에 작업 관리자에 setup.exe가 없습니다. 30 분이 넘었고 파일이 실행되었다는 증거는 찾을 수 없습니다.

문제를 해결하는 방법?

+1

어쩌면'{ "테스트"와 같은를 ScriptBlock에서 간단한 명령을 시도 또한 도움이되었다 | Out-File 'C : \ Test.txt'}'를 실행하고 원격 컴퓨터에서 해당 파일을 생성하는지 확인하십시오. – TheMadTechnician

+0

@TheMadTechnician 예,이 명령은 – Glowie

+0

을 처리했습니다. – Glowie

답변

0

wmirm.cmd 사용하여 TrustedHosts를 추가 한 후, 다음 명령은 machineA 및 machineB 모두에서 방화벽을 해제하고, 시스템 A에 winrm set winrm/config/client @{TrustedHosts="machineB"}을 실행과 함께

invoke-command -ComputerName remote_Computer -credential $cred -scriptBlock {cmd /c 'C:\share\setup.exe'}