2016-09-13 3 views
1

아주 간단한 Powershell DSC 스크립트를 로컬로 실행하려고합니다. (필자는이 단계에서 설정 파일을 가져 오지 않을 것입니다.)Powershell DSC 스크립트를 로컬에서 실행하는 방법

다음과 같은 오류 메시지가 나타납니다. WS 관리 서비스가 실행 중이지만 방화벽 구멍이나 포트가 예약되어 있지 않습니다 (서버가 웹 서버로 존재 함) ... 어쨌든이 서버가 로컬 요청 만 수락하도록 허용 할 수 있습니까?

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". + CategoryInfo : ConnectionError: (root/Microsoft/...gurationManager:String) [], CimException + FullyQualifiedErrorId : HRESULT 0x80338012 + PSComputerName : localhost

configuration SampleIISInstall 
    { 
     Node 127.0.0.1 
     { 
      File FileDemo { 
      Type = 'Directory' 
      DestinationPath = 'C:\TestUser3' 
      Ensure = "Present" 
     } 
     } 
    } 

    # Compile the configuration file to a MOF format 
    SampleIISInstall 

    # Run the configuration on localhost 
    Start-DscConfiguration -Path .\SampleIISInstall -Wait -Force -Verbose 

답변

3

시도 : DSC 이후

 
configuration SampleIISInstall 
    { 
     Node "localhost" 
     { 
      File FileDemo { 
      Type = 'Directory' 
      DestinationPath = 'C:\TestUser3' 
      Ensure = "Present" 
     } 
     } 
    } 

    # Compile the configuration file to a MOF format 
    SampleIISInstall 

    # Run the configuration on localhost 
    Start-DscConfiguration -Path .\SampleIISInstall -Wait -Force -Verbose 
2

당신이 컴퓨터 이름을 지정해야하는 노드 이름에 대한 IP 주소를 사용할 수 없습니다 리모팅 PowerShell을 사용합니다. localhost 또는 $ env : computername을 사용하면 노드 블록을 완전히 제거하고 DSC 구성없이 DSC 구성을 작성할 수 있습니다.

configuration SampleIISInstall 
    { 
      File FileDemo { 
      Type = 'Directory' 
      DestinationPath = 'C:\TestUser3' 
      Ensure = "Present" 
     } 
     } 

    # Compile the configuration file to a MOF format 
    SampleIISInstall 

    # Run the configuration on localhost 
    Start-DscConfiguration -Path .\SampleIISInstall -Wait -Force -Verbose 
관련 문제