前言

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的更多相关文章

  1. 6.PowerShell DSC核心概念之LCM

    什么是LCM? 本地配置管理器 (LCM) 是DSC的引擎. LCM 在每个目标节点上运行,负责分析和执行发送到节点的配置. 它还负责 DSC 的许多方面,包括以下各方面. 确定刷新模式(推送或请求) ...

  2. 10.PowerShell DSC之细节

    mof文件到各Node放在哪里了? 在C:\Windows\System32\Configurtion文件夹下: 你可能会注意到mof的文件名称和Pull Server上的不一致,并且多出了几个.不用 ...

  3. 9.PowerShell DSC之Pull

    前言 一般生产环境都使用Pull模式 配置Pull Server 配置Pull Server需要安装两个WindowsFeture:IIS.windows DSC,这两都可以通过UI界面化引导安装,也 ...

  4. 5.PowerShell DSC核心概念之资源

    什么是资源? 资源为 DSC 配置提供构建基块. 资源公开可配置的属性,并包含本地配置管理器 (LCM) 调用以"使其如此"的 PowerShell 脚本函数. 系统内置资源 可在 ...

  5. 4.PowerShell DSC核心概念之配置

    什么是配置 DSC 配置是定义某一特殊类型函数的 PowerShell 脚本. 配置的语法 Configuration MyDscConfiguration { #配置块 Import-DscReso ...

  6. 3.PowerShell DSC核心概念

    PowerShell DSC有三个核心概念 配置 配置是声明性的PowerShell 脚本,用于定义和配置资源实例. DSC 配置是幂等的. 资源 资源是 DSC 的"实现器"部分 ...

  7. 1.PowerShell DSC概述

    什么是PowerShell DSC DSC 是一个声明性平台,用于配置.部署和管理系统. PowerShell PowerShell 是构建于 .NET 上基于任务的命令行 shell 和脚本语言. ...

  8. PowerShell DSC学习资料

    官网 https://docs.microsoft.com/zh-cn/powershell/dsc/overview/overview CSDN中文博客(专题,32篇) https://blog.c ...

  9. 7.PowerShell DSC之模式

    DSC两种模式 DSC有两种模式,Push模式和Pull模式 Push模式 基本流程 写配置--编译生成mof--推送到目标服务器,由目标服务器LCM执行mof并进行指定的配置 优点 架构简单.成本低 ...

随机推荐

  1. 改进你的c#代码的5个技巧(四)

    像每一篇文章一样,我会重复几行.我在我的Core i3 CPU.4GB主内存和Windows 7平台上测试了以下代码.如果你在不同的硬件配置或使用不同的平台,那么你的输出可能会随着我的输出屏幕而变化, ...

  2. 【Linux】centos7中 root家目录中perl5文件夹无法删除问题解决

    由于新项目上线,安装了一些perl的一些包 但是发现,在/root下有一个perl5/的文件夹,删除后,重新登录又会出现,很是烦人,而且他还没有内容,就是一个空文件 那么着手搞掉他 环境:centos ...

  3. Oracle Rac to Rac One Node

    =~=~=~=~=~=~=~=~=~=~=~= PuTTY log 2020.01.14 20:05:12 =~=~=~=~=~=~=~=~=~=~=~= [oracle@rac01 ~]$ srvc ...

  4. 从零开始学spring源码之xml解析(一):入门

    谈到spring,首先想到的肯定是ioc,DI依赖注入,aop,但是其实很多人只是知道这些是spring核心概念,甚至不知道这些代表了什么意思,,作为一个java程序员,怎么能说自己对号称改变了jav ...

  5. kvm虚拟机管理(创建、连接)

    创建虚机.远程管理kvm虚机.virsh命令行下管理虚机..kvm通过virsh console 连入虚拟机   一.创建虚机 1)打开虚拟化管理器

  6. IDEA SSM+MAVEN+JWT 图书管理系统

    压缩包内含有MAVEN,TOMCAT,需要手动对IDEA进行配置.同时也包含数据库文件. 项目搭载了swagger,可以方便地对接口进行测试 在开发的过程中我也进行了一些记录,可以参考https:// ...

  7. 【汇编实践】go assembly

    https://mp.weixin.qq.com/s/B577CdUkWCp_XgUc1VVvSQ asmshare/layout.md at master · cch123/asmshare htt ...

  8. 结合python版本安装python-devel gcc和g++的区别 安装前做yum搜索

    [test@ecs autocloudservices]# yum install python-develLoaded plugins: fastestmirrorLoading mirror sp ...

  9. dp - 斜率优化笔记

    (原来的题解没得了,只好重写一份) 斜率优化一般是,\(dp\) 是枚举一个 \(i\),然后前面找一个 \(j\),式子中有些和 \(j\) 有关,有些和 \(i\) 有关,有些和俩都有关. 过程中 ...

  10. yum安装docker-ce-18.03.0

    yum install -y yum-utils device-mapper-persistent-data lvm2 yum-config-manager --add-repo http://mir ...