LCM的默认mode就是push,所以对于push模式,我们直接就三步走
以下是示例:
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:\test\index.htm'
DestinationPath = 'c:\inetpub\wwwroot'
}
}
}
. .\WebsiteTest.ps1
WebsiteTest
Start-DscConfiguration .\WebsiteTest
https://docs.microsoft.com/en-us/powershell/dsc/quickstarts/website-quickstart
原文:https://www.cnblogs.com/talentzemin/p/11587513.html