前言
LCM的默认mode就是push,所以对于push模式,我们直接就三步走
以下是示例:
1.编写配置 Authoring
Configuration WebsiteTest {
# Import the module that contains the resources we're using.
Import-DscResource -ModuleName PsDesiredStateConfiguration
# The Node statement specifies which targets this configuration will be applied to.
Node 'TargetComputerName' {
# The first resource block ensures that the Web-Server (IIS) feature is enabled.
WindowsFeature WebServer {
Ensure = "Present"
Name = "Web-Server"
}
# The second resource block ensures that the website content copied to the website root folder.
File WebsiteContent {
Ensure = 'Present'
SourcePath = 'c: estindex.htm'
DestinationPath = 'c:inetpubwwwroot'
}
}
}
2.编译配置 Staging
. .WebsiteTest.ps1
WebsiteTest
3.应用配置 Execution
Start-DscConfiguration .WebsiteTest
参考
https://docs.microsoft.com/en-us/powershell/dsc/quickstarts/website-quickstart