首页 > 系统服务 > 详细

8.PowerShell DSC之Push

时间:2019-09-25 21:56:02      阅读:115      评论:0      收藏:0      [点我收藏+]

前言

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:\test\index.htm'
            DestinationPath = 'c:\inetpub\wwwroot'
        }
    }
}

2.编译配置 Staging

. .\WebsiteTest.ps1
WebsiteTest

3.应用配置 Execution

Start-DscConfiguration .\WebsiteTest

参考

https://www.red-gate.com/simple-talk/sysadmin/powershell/powershell-desired-state-configuration-lcm-and-push-management-model/

https://docs.microsoft.com/en-us/powershell/dsc/quickstarts/website-quickstart

8.PowerShell DSC之Push

原文:https://www.cnblogs.com/talentzemin/p/11587513.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!