2013-09-25 1 views
-2

다음 헤더가 포함 된 서버 목록을 가져 오는 powershell 스크립트가 있습니다. 컴퓨터 이름, optype, opname. 그런 다음 루프를 통해 서버, 서비스, 서비스 이름 형식이있는 경우 서비스를 시작/중지합니다. server, script, script_path_name의 형식을 가지고 있다면 스크립트를 실행하기 위해 invoke-command를 사용하려고합니다. 그러나 어떻게 든 원격 세션을 설정해야합니다 ... 여기에 오류 txt가 있습니다. 여기 Powershell and Psession

[c1399] Connecting to remote server c1399 failed with the following error message : The client cannot connect to the destination specified in the request. Verify that the service on the destination is running and is accepting requests. Consult the logs and documentation for the WS-Management service running on the destination, most commonly IIS or WinRM. If the destination is the WinRM service, run the following command on the destination to analyze and configure the WinRM service: "winrm quickconfig". For more information, see the about_Remote_Troubleshooting Help topic. + CategoryInfo : OpenError: (c1399:String) [], PSRemotingTransportException + FullyQualifiedErrorId : CannotConnect,PSSessionStateBroken

elseif($computer.optype -eq "script") 
{  
    write-host running script $computer.opname on $computer.computername 
    $Status = Invoke-Command -ComputerName $computer.computername -ScriptBlock { . $computer.opname } 
    Write-Output "Script execution status for $($computer.name) is $Status" >> C:\Scripts\RMLog.txt 
} 
+0

오류 메시지에서 수행 할 작업을 수행 했습니까? 원격 컴퓨터에서 PSRemoting을 활성화 했습니까? – alroc

답변