2014-10-14 3 views
1

내가 원격 PC에 내 로컬 컴퓨터에서 PowerShell 스크립트를 실행하려면이 명령을 사용하고 원격 서버에 연결을 시도하지만, 다음과 같은 오류어떻게 PowerShell을

[my ip] Connecting to remote server "my ip" 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.

  • CategoryInfo : OpenError: (my ip:String) [], PSRemotingTransportException
  • FullyQualifiedErrorId : CannotUseIPAddress,PSSessionStateBroken

을 얻고을 사용하여 원격 서버에 연결
내 보라 :

내 스크립트

$serverName = 'my ip' 
$pwd = convertto-securestring "password12" -asplaintext -force 
$cred=new-object -typename System.Management.Automation.PSCredential -argumentlist 
".\Administrator",$pwd 

Invoke-Command -computername $serverName {$("C:\_Projects\test.ps1")} 

편집이다 cal pc와 원격 컴퓨터가 같은 도메인에 있지 않습니다. 예를 들어 내 로컬 pc에 mypc.test.local이 표시되고 원격 컴퓨터에 작업 그룹이 표시됩니다. UAT 서버이기 때문에 원격 컴퓨터의 설정을 변경하지 않아도 위의 오류를 정렬하는 방법에 대해 도움을 줄 수 있습니까?

+0

내 로컬 PC와 원격 컴퓨터가 동일한 도메인에 있지 않습니다. 예를 들어 내 로컬 pc에 mypc.test.local이 표시되고 원격 컴퓨터에 작업 그룹이 표시됩니다. UAT 서버 – srk786

+0

중요한 정보이므로 게시물에 해당 주석을 편집해야하기 때문에 원격 컴퓨터의 설정을 변경하지 않고 위의 오류를 정렬하는 방법에 대해 도움을 줄 수 있습니까? – alroc

+0

Invoke-command 명령에'-credential $ cred'를 추가해야합니다. –

답변

0

Invoke-command 명령에 -credential $cred을 추가해야합니다. 관리자 이름에서. \을 제거해야 할 수도 있습니다. 테스트 할 작업 그룹 서버가 없으므로 제대로 작동하는지 확신 할 수 없습니다.

Invoke-Command -credential $cred -computername $serverName {$("C:\_Projects\test.ps1")}

+0

@ 세레나트 :이게 효과가 있었나요? –