2012-02-24 5 views
1

WebAdministration 모듈과 함께 PSRemoting을 사용하여 여러 사이트에 대한 정보를 얻고 있습니다. 그러나 명령을 호출하는 동안 귀찮은 치명적이지 않은 COM 예외를 수신하고 다른 사람이 해결했는지 궁금합니다.PowerShell IIS : WebAdmin 원격 호출로 인해 WSAStartup 오류 WSANOTINITIALISED가 발생합니다.

Invoking 

protocol   : http 
bindingInformation : 10.x.x.x:80:alias 
... 
Schema    : Microsoft.IIs.PowerShell.Framework.ConfigurationElementSchema 

An unhandled COM interop exception occurred: Either the application has not called WSAStartup, or WSAStartup failed. (Exception from HRESULT: 0x800 
7276D) 
    + CategoryInfo   : InvalidOperation: (:) [], RuntimeException 
    + FullyQualifiedErrorId : COMException 

Invoked 
Removing 
Removed 

나는 결과가 이전에 오류가 발생되고 반환됩니다 관찰 :

cls 
$command = { 
    param($alias) 
    Import-Module 'WebAdministration' 
    $binding = Get-WebBinding -HostHeader $alias 
    $binding 
} 

$server = 'server' 
$args = @('alias') 
$session = New-PSSession -ComputerName $server 
Write-Host ("Invoking") 
try { 
    Invoke-Command -Session $session -ScriptBlock $command -ArgumentList $args 
    Write-Host ("Invoked") 
} catch { 
    Write-Host ("Caught $_") 
} finally { 
    Write-Host ("Removing") 
    Remove-PSSession -Session $session 
    Write-Host ("Removed") 
} 

그리고 여기가 결과입니다 : 여기에 최소한의 구현입니다.

재미있는 세부 정보 :
- 받기 - 웹 사이트, 취득 품목을 "IIS : \ ..."은 Get-WebBinding 같은 오류가 모든 결과를
-에 기록 된 결과로 대상 시스템에 직접 $ 명령을 실행 오류
- 받기 - 항목 "D : \ ..."- co.kr에서 오류가하는이 깊은 .NET의 PowerShell을 구현의 창자에 어딘가에 묻혀하지

+0

내가 PowerGUI를하고 파워 쉘 프롬프트에서 2 개 다른 대상 서버에 대해 3 개 별도의 W2K8 서버에서이 코드를 실행했습니다 – codepoke

+0

흥미롭게도 NetMon은 실패한 WebAdmin 세션과 "성공적인"Get-Item 'd : \'세션간에/wsman을 사용한 암호화 된 대화가 매우 유사 함을 보여줍니다. 두 대화는 원격 서버가 암호화 된 데이터를 보내고, 마지막으로 (이론적으로 연결 끊기 요청에?) 500 내부 서버 오류로 끝납니다. 거기에는 진짜 정보가 없습니다. 대화를 해독 할 수 없기 때문에 흥미 롭습니다. – codepoke

+0

자세한 정보 표시 모드에 있기 때문에 내부 클라이언트가 오류를보고 나를 괴롭히기 때문에 이것이 중요합니다. 이를 위해 실제 해결 방법을 찾을 때까지 "-ErrorAction SilentlyContinue"를 원격 호출에 추가했습니다. 문제를 처리합니다. – codepoke

답변

0

오류
발생하지 않습니다 윈속. 그것은 내가 교정 할 수있는 것 아래에 있으므로 원격 호출에 "-ErrorAction SilentlyContinue"를 추가했습니다. 아무것도 수정하지 않지만 모든 것이 올바르게 작동합니다. 이제 충분한 답변입니다.

$iisIpAddresses = Invoke-Command -Session $session -scriptblock { 
    if (!(Get-Module WebAdministration)) 
    { 
     Import-Module WebAdministration 
    } 
    $iisBindings = Get-WebBinding 
    [String[]]$iisBindings = $iisBindings | Select bindingInformation 
    $iisBindings 
} 

Remove-PSSession $session 
2

나는 다음과 같은 사용하여 문제를 해결할 수 있었다. 모든 경우에 동일한 오류가 발생했습니다.