加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 资源网站 > 资源 > 正文

web-services – 如何在本地运行Powershell DSC脚本

发布时间:2020-12-14 19:39:14 所属栏目:资源 来源:网络整理
导读:我正试图在本地运行一个非常简单的Power shell DSC脚本. (我从不计划在此阶段提取或推送配置文件) 我收到以下错误消息. WS-Management服务正在运行,但没有保留防火墙漏洞或端口(服务器恰好是一个Web服务器)…反正我是否可以允许此服务器只接受本地请求? The
我正试图在本地运行一个非常简单的Power shell DSC脚本. (我从不计划在此阶段提取或推送配置文件)

我收到以下错误消息. WS-Management服务正在运行,但没有保留防火墙漏洞或端口(服务器恰好是一个Web服务器)…反正我是否可以允许此服务器只接受本地请求?

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

解决方法

尝试:
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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读