gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-04 14:24:35 24 4
gpt4 key购买 nike

我正在尝试在本地运行一个非常简单的 Powershell DSC 脚本。 (我从不打算在这个阶段拉或推配置文件)

我收到以下错误消息。 WS-Management 服务正在运行,但没有保留防火墙漏洞或端口(服务器恰好是网络服务器)...无论如何我可以允许该服务器仅接受本地请求吗?

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

最佳答案

尝试:

配置示例IIS安装
{
节点“本地主机”
{
文件文件演示{
类型 = '目录'
目标路径 = 'C:\TestUser3'
确保=“存在”
}
}
}

# 将配置文件编译为MOF格式
示例IIS安装

# 在本地主机上运行配置
开始-DscConfiguration -Path .\SampleIISInstall -Wait -Force -Verbose

关于web-services - 如何在本地运行 Powershell DSC 脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39460820/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com